<template>
  <el-scrollbar ref="scrollbarRef" always @scroll="scroll" v-loading="loading">
    <!-- <div style="height:100%" v-loading="loading"> -->
    <!-- <div style="width: 100%;height: 100%;overflow-y:auto;" @scroll="scroll"> -->
    <el-row class="app-container" id="detail" ref="detail" justify="space-between">
      <el-col class="detail-container" :span="18" :lg="18" :xl="19">
        <Title :name="metaTitle" id="taskDetail" ref="taskDetail"></Title>
        <div class="detail-form">
          <el-form label-width="160px" v-model="taskInfo">
            <div class="detail-form-item">
              <div v-if="taskInfo.taskNum">
                <el-form-item label="任务编号：" prop="taskNum">
                  <span>{{ taskInfo.taskNum }}</span>
                </el-form-item>
              </div>
              <div v-if="taskInfo.groupName">
                <el-form-item label="承担小组：" prop="groupName">
                  <span>{{ taskInfo.groupName }}</span>
                </el-form-item>
              </div>
              <div v-if="taskInfo.taskManager">
                <el-form-item label="任务管理员：" prop="taskManager">
                  <span>{{ taskInfo.taskManager }}</span>
                </el-form-item>
              </div>
              <div v-if="taskInfo.groupLeader">
                <el-form-item label="小组组长：" prop="groupLeader">
                  <span>{{ taskInfo.groupLeader }}</span>
                </el-form-item>
              </div>
              <div v-if="taskInfo.groupExpert">
                <el-form-item label="小组成员：" prop="groupMember">
                  <span>{{ taskInfo.groupMember }}</span>
                </el-form-item>
              </div>
              <div v-if="taskInfo.groupExpert">
                <el-form-item label="专家成员：" prop="groupExpert">
                  <span>{{ taskInfo.groupExpert }}</span>
                </el-form-item>
              </div>
              <div v-if="taskInfo.parentTask">
                <el-form-item label="所属父任务：" prop="parentTask">
                  <span>{{ taskInfo.parentTask }}</span>
                </el-form-item>
              </div>
              <div v-if="taskInfo.taskStatus">
                <el-form-item label="任务状态：" prop="taskStatus">
                  <span v-if="taskInfo.taskStatus == '0'">未分配</span>
                  <span v-else-if="taskInfo.taskStatus == '1'">进行中</span>
                  <span v-else-if="taskInfo.taskStatus == '2'">审核中</span>
                  <span v-else-if="taskInfo.taskStatus == '3'">已结束</span>
                </el-form-item>
              </div>
              <div v-if="taskInfo.assessmentUserId">
                <el-form-item label="预评估人：" prop="assessmentUserId">
                  <span>{{ taskInfo.assessmentUserId }}</span>
                </el-form-item>
              </div>
              <div v-if="taskInfo.assessmentUserDept">
                <el-form-item label="预评估人所在单位：" prop="assessmentUserDept">
                  <span>{{ taskInfo.assessmentUserDept }}</span>
                </el-form-item>
              </div>
              <div v-if="taskInfo.assessmentTime">
                <el-form-item label="预评估日期：" prop="assessmentTime">
                  <span>{{ taskInfo.assessmentTime }}</span>
                </el-form-item>
              </div>
            </div>
          </el-form>
        </div>

        <Title name="设定地震" id="setEarthquake" ref="setEarthquake" v-if="!isSetEQ"></Title>
        <div class="detail setEarthquake" v-if="!isSetEQ">
          <ul>
            <li>
              <h4>
                <Title name="生成设定地震" id="setEarthquake-1" ref="setEarthquake-1" own="setEarthquake"></Title>
              </h4>
              <div class="setEarthquake-detail-1">
                <el-row v-if="isBtn">
                  <template v-if="curTaskType != '1'">
                    <el-col :lg="4" :xl="3">
                      <el-button type="primary" @click="pointSetEarthquake" :disabled="!isEdit">点状设定地震</el-button>
                    </el-col>
                    <el-col :lg="4" :xl="3">
                      <el-button type="primary" @click="faultSetEarthquake" :disabled="!isEdit">断层设定地震</el-button>
                    </el-col>
                    <el-col :lg="4" :xl="3">
                      <el-button type="primary" @click="gridSetEarthquake" :disabled="!isEdit">公里格网设定地震</el-button>
                    </el-col>
                  </template>
                  <!-- <el-col :span="4">
                      <el-button type="primary">公里格网设定地震</el-button>
                    </el-col> -->
                  <el-col v-if="curTaskType == '1' && taskType == '1'" :lg="4" :xl="3">
                    <el-button plain @click="setEQAssignment">
                      <img src="@/assets/images/share.png" alt="">
                      分配子任务
                    </el-button>
                  </el-col>
                </el-row>
                <!-- <el-row justify="start" v-if="taskType == '0' && curTaskType == '3'">
                  <el-col :lg="4" :xl="3">
                    <el-button type="primary" @click="pointSetEarthquake" :disabled="!isEdit">补充点状设定地震</el-button>
                  </el-col>
                </el-row> -->
                <el-space v-if="taskType == '0' && curTaskType == '1'" :size="20">
                  <el-button type="primary" size="large" @click="updateEQNum">更新设定地震序号</el-button>
                  <el-space direction="vertical" alignment="start">
                    <span style="color: var(--el-text-color-regular);font-size: 14px;">如设定地震序号不连续，可使用此功能对设定地震序号重新排序，将会同时更新子任务设定地震序号。</span>
                    <span style="color: var(--el-text-color-regular);font-size: 14px;">如已生成影响场及评估计算，修改设定地震后请重新生成影响场及重新计算。</span>
                    <span style="color: var(--el-text-color-regular);font-size: 14px;">如已生成报告图件，需在更新设定地震序号后重新生成报告及图件。</span>
                  </el-space>
                </el-space>
                <div v-if="setEarthquakeList.length > 0">
                  <el-row justify="space-between">
                    <el-button plain v-if="setEarthquakeList.length > 0 && curTaskType != '1'" icon="Delete"
                      @click="batchDelete" :disabled="!isEdit">批量删除</el-button>
                    <p></p>
                    <ul class="setEarthquake-tips">
                      <li><span>共计{{ groupNum }}组设定地震，每组设定地震按照不同震级、角度统计共计{{ totalNum }}条。</span></li>
                    </ul>
                  </el-row>
                  <el-row class="setEarthquake-table">
                    <!-- <el-col :span="18"> -->
                    <el-table :data="setEarthquakeList" :border="true" stripe @selection-change="selectSetEQ" :fit="true">
                      <el-table-column type="selection" align="center" width="50" />
                      <el-table-column label="设定地震序号" align="center" prop="faultNum" />
                      <el-table-column label="经度" align="center" prop="longitude" />
                      <el-table-column label="纬度" align="center" prop="latitude" />
                      <el-table-column label="宏观位置" align="center" prop="macroPosition" min-width="200" />
                      <el-table-column label="每组条数" align="center" prop="count" />
                      <el-table-column label="操作" align="center">
                        <template #default="{ row }">
                          <el-link type="primary" :underline="false" @click="viewSetEQDetail(row)">查看明细</el-link>
                          <el-link v-if="!isHaveSetEQ" type="primary" :underline="false"
                            @click="deleteSetEQDetail(row.faultNum)">删除</el-link>
                        </template>
                      </el-table-column>
                    </el-table>
                    <!-- </el-col> -->
                  </el-row>
                </div>
              </div>
            </li>
            <li>
              <h4>
                <Title name="选择计算范围" id="setEarthquake-2" ref="setEarthquake-2" own="setEarthquake"></Title>
              </h4>
              <div class="setEarthquake-detail-2">
                <el-link type="primary" :underline="false">
                  受灾区域面积，灾区总人口，灾区范围内GDP，死亡人数，受伤人数，经济损失，需紧急安人数，救援力量，需物资，根据选择按影响场范围或任务区域与影响场相交范围来计算。
                </el-link>
                <el-link type="primary" :underline="false">
                  建筑物抗震能力，区县致死性差异性分析，地震滑坡是按照任务范围来计算。
                </el-link>
                <el-row style="margin-top: 15px;">
                  <el-radio-group v-model="calculateRange" @change="calculateRangeChange">
                    <el-radio label="0" size="large">影响场范围</el-radio>
                    <el-radio label="1" size="large">任务区域与影响场相交范围</el-radio>
                  </el-radio-group>
                </el-row>
              </div>
            </li>
            <li v-if="!isAssign">
              <h4>
                <Title name="生成地震影响场" id="setEarthquake-3" ref="setEarthquake-3" own="setEarthquake"></Title>
              </h4>
              <div class="flex items-center text-sm">
                <el-radio-group v-model="setEQ" @change="radioChange">
                  <el-radio label="1" size="large">选择烈度衰减关系模型</el-radio>
                  <el-radio label="2" size="large">手工填写地震影响场长短轴长度</el-radio>
                  <el-radio label="3" size="large">导入地震影响场</el-radio>
                </el-radio-group>
              </div>
              <div class="setEarthquake-detail-3">
                <div v-show="setEQ == '1'">
                  <el-row>
                    <el-col :span="10" :lg="10" :xl="8">
                      <Card :data="intensityData" :isEdit="isEdit" type="1"></Card>
                    </el-col>
                  </el-row>
                </div>
                <div v-show="setEQ == '2'">
                  <el-form ref="mercalliScaleRef" :model="mercalliScale" :rules="mercalliScaleRules">
                    <el-row>
                      <el-col :lg="10" :xl="8">
                        <el-form-item label="震中烈度：" prop="select">
                          <el-select v-model="mercalliScale.select" placeholder="请选择" style="width: 100%;"
                            @change="mercalliScaleChange" :disabled="!isEdit">
                            <el-option v-for="(key, val) in optionType.mercalliScale" :key="key" :label="key"
                              :value="val">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row v-show="mercalliScale.select">
                      <el-col :lg="10" :xl="8">
                        <el-form-item label=" " prop="list">
                          <el-table :data="mercalliScale.list" :border="true" stripe>
                            <el-table-column label="烈度" align="center" prop="intensity" width="100" />
                            <el-table-column label="长轴长度（公里）" align="center" prop="longAxis">
                              <template #default="{ row }">
                                <el-input type="text" v-model="row.longAxis" />
                              </template>
                            </el-table-column>
                            <el-table-column label="短轴长度（公里）" align="center" prop="shortAxis">
                              <template #default="{ row }">
                                <el-input type="text" v-model="row.shortAxis" />
                              </template>
                            </el-table-column>
                          </el-table>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-form>
                </div>
                <div v-show="setEQ == '3'" class="setEarthquake-detail-3">
                  <p class="explain">
                    文件导入字段说明：请使用【CGCS2000】坐标系，标准公里格网。
                    <el-popover placement="top-start" :width="600" trigger="hover">
                      <template #reference>
                        <el-icon style="vertical-align: text-top;">
                          <WarningFilled />
                        </el-icon>
                      </template>
                      <el-table :data="influenceieldList" :border="true" stripe>
                        <el-table-column label="序号" type="index" align="center" width="60" />
                        <el-table-column label="数据名称" align="center" prop="x1" />
                        <el-table-column label="数据类型" align="center" prop="x2" />
                        <el-table-column label="是否必填" align="center" prop="x3" />
                        <el-table-column label="示例" align="center" prop="x4" />
                      </el-table>
                    </el-popover>
                  </p>
                  <el-row>
                    <el-col :span="3">地震影响场：</el-col>
                    <el-col :span="4" v-if="setEQ == '3'">
                      <el-button @click="influencefliedEarthquake('查看地震影响场')" class="success-btn-icon" type="primary">
                        <el-icon>
                          <SuccessFilled />
                        </el-icon>查看地震影响场
                      </el-button>
                    </el-col>
                  </el-row>
                  <el-row class="setEarthquake-table">
                    <el-col :span="16" :xl="16" :lg="24" :md="24">
                      <el-table :data="settingSeismicDetails" :border="true" stripe v-loading="settingSeismicLoading">
                        <el-table-column label="设定地震序号" prop="faultNum" align="center" width="80" />
                        <el-table-column label="经度" align="center" prop="longitude" />
                        <el-table-column label="纬度" align="center" prop="latitude" />
                        <el-table-column label="宏观位置" align="center" prop="macroPosition" min-width="200" />
                        <el-table-column label="震级" align="center" prop="earthquakeLevel" />
                        <el-table-column label="角度" align="center" prop="angle" />
                        <el-table-column label="操作" align="center">
                          <template #default="{ row, $index }">
                            <el-button type="primary" @click="upload($index)">
                              <span v-if="row.importFlag == '1'">重新上传</span>
                              <span v-else>上传</span>
                              <input type="file" @change="uploadFileChange($index, row)" style="width: 70px;display:none"
                                :id="('influenceflied-button-selectfile' + $index)" multiple="multiple"
                                accept=".shp,.dbf,.prj,.sbn,.sbx,.shp.xml,.shx,.cpg" />
                            </el-button>
                          </template>
                        </el-table-column>
                      </el-table>
                    </el-col>
                  </el-row>
                  <!-- <el-row>
                    <el-col :span="3">地震影响场：</el-col>
                    <el-col :span="3">
                      <input type="file" @change="uploadFileChange" style="width: 70px;" id="influenceflied-button-selectfile" multiple="multiple" accept=".shp,.dbf,.prj,.sbn,.sbx,.shp.xml,.shx,.cpg" />
                    </el-col>
                    <el-col :span="2">
                      <el-button @click="uploadFileClick" type="primary">上传</el-button>
                    </el-col>
                    <el-col :span="4" v-if="intensityType == setEQ">
                      <el-button @click="influencefliedEarthquake('查看地震影响场')" class="success-btn-icon" type="primary"
                                 plain>
                        <el-icon>
                          <SuccessFilled />
                        </el-icon>查看地震影响场
                      </el-button>
                    </el-col>
                  </el-row> -->
                </div>
                <div v-if="setEQ != '3'">
                  <div v-if="intensityType == '1' && curSetEQ == setEQ">
                    <el-button type="primary" @click="creatEqIntensity(setEQ)" :disabled="!isEdit">重新生成地震影响场</el-button>
                    <el-button @click="influencefliedEarthquake('查看地震影响场')" class="success-btn-icon" type="primary" plain>
                      <el-icon>
                        <SuccessFilled />
                      </el-icon>查看地震影响场
                    </el-button>
                  </div>
                  <div v-else>
                    <el-button type="primary" @click="creatEqIntensity(setEQ)" :disabled="!isEdit">生成地震影响场</el-button>
                  </div>
                </div>
              </div>
            </li>
          </ul>
        </div>
        <!--上传结果弹窗-->
        <el-dialog title="系统信息" v-model="uploadInfoVisible" width="30%" :before-close="uploadHandleClose">
          <p v-html='uploadMsg' class="new-dialog-content"></p>
          <p class="new-dialog-footer">
            <el-button type="primary" @click="uploadHandleClose">关闭</el-button>
          </p>
        </el-dialog>
        <div v-if="!isAssign">
          <Title name="生成建筑物抗震能力分布" id="buildVulnerability" ref="buildVulnerability"></Title>
          <div class="detail detail-left">
            <el-space wrap :size="12">
              <el-button type="primary" @click="saveSeiCapCalOfBuilding(0)" :disabled="!isEdit"
                v-if="buildVulnerabilityFlag == '0'">生成区县建筑物抗震能力分布</el-button>
              <el-button type="primary" @click="saveSeiCapCalOfBuilding(0)" :disabled="!isEdit"
                v-if="buildVulnerabilityFlag == '1'">重新生成区县建筑物抗震能力分布</el-button>

              <el-button type="primary" @click="saveSeiCapCalOfBuilding(1)" :disabled="!isEdit"
                v-if="buildVulnerabilityFlag2 == '0'">生成乡镇建筑物抗震能力分布</el-button>
              <el-button type="primary" @click="saveSeiCapCalOfBuilding(1)" :disabled="!isEdit"
                v-if="buildVulnerabilityFlag2 == '1'">重新生成乡镇建筑物抗震能力分布</el-button>

              <el-button type="primary" @click="saveSeiCapCalOfBuilding(2)" :disabled="!isEdit"
                v-if="buildVulnerabilityFlag3 == '0'">生成公里格网建筑物抗震能力分布</el-button>
              <el-button type="primary" @click="saveSeiCapCalOfBuilding(2)" :disabled="!isEdit"
                v-if="buildVulnerabilityFlag3 == '1'">重新生成公里格网建筑物抗震能力分布</el-button>
              <el-button class="success-btn-icon" type="primary" plain @click="influencefliedEarthquake('查看建筑物抗震能力分布')"
                v-if="buildVulnerabilityFlag == '1' || buildVulnerabilityFlag2 == '1' || buildVulnerabilityFlag3 == '1'">
                <el-icon>
                  <SuccessFilled />
                </el-icon>查看建筑物抗震能力分布
              </el-button>
              <el-button type="primary" @click="exportSeiCapCalOfBuilding(0)"
              v-if="buildVulnerabilityFlag == '1'">导出区县建筑物抗震能力</el-button>
              <el-button type="primary" @click="exportSeiCapCalOfBuilding(1)"
              v-if="buildVulnerabilityFlag2 == '1'">导出乡镇建筑物抗震能力</el-button>
              <el-button type="primary" @click="exportSeiCapCalOfBuilding(2)"
                v-if="buildVulnerabilityFlag3 == '1'">导出公里格网建筑物抗震能力</el-button>
            </el-space>
          </div>

          <Title name="区县致死性差异性分析" id="modeldifference" ref="modeldifference"></Title>
          <div class="detail detail-left">
            <div v-if="differenceFlag == '0'">
              <!-- <el-button type="primary" @click="saveModeldifferenceCreateFinalValue"
                :disabled="!isEdit">生成区县致死性差异性分析</el-button> -->
              <el-button type="info" plain  disabled @click="saveModeldifferenceCreateFinalValue"
                >生成区县致死性差异性分析</el-button>
            </div>
            <div v-else-if="differenceFlag == '1'">
              <!-- <el-button type="primary" @click="saveModeldifferenceCreateFinalValue"
                :disabled="!isEdit">重新生成区县致死性差异性分析</el-button> -->
              <el-button type="info" plain @click="saveModeldifferenceCreateFinalValue"
                disabled>重新生成区县致死性差异性分析</el-button>
              <el-button class="success-btn-icon" type="primary" plain @click="influencefliedEarthquake('查看区县致死性差异性分布')">
                <el-icon>
                  <SuccessFilled />
                </el-icon>查看区县致死性差异性分析
              </el-button>
            </div>
          </div>

          <Title name="选择模型" id="selectModel" ref="selectModel"></Title>
          <div class="detail">
            <ul>
              <li>
                <h4>
                  <Title name="人员伤亡模型" id="selectModel-1" ref="selectModel-1" own="selectModel"></Title>
                </h4>
                <el-row align="top" :gutter="20">
                  <el-col :span="10" :lg="10" :xl="8">
                    <Card :data="casualtiesData" :isEdit="isEdit" type="2"></Card>
                  </el-col>
                  <el-col :span="6" class="calc-btn">
                    <p v-if="casualtiesCalcFlag == '0'">
                      <el-button type="primary" @click="casualtiesCalc(0)" :disabled="!isEdit">①计算各烈度下建筑物破坏</el-button>
                    </p>
                    <p v-else>
                      <el-button type="primary" @click="casualtiesCalc(0)" :disabled="!isEdit">①重新计算各烈度下建筑物破坏</el-button>
                    </p>
                    <p v-if="casualtiesCalcFlag2 == '0'">
                      <el-button type="primary" @click="casualtiesCalc2" :disabled="!isEdit">②计算各烈度下人员伤亡</el-button>
                    </p>
                    <p v-else>
                      <el-button type="primary" @click="casualtiesCalc2" :disabled="!isEdit">②重新计算各烈度下人员伤亡</el-button>
                    </p>
                    <p v-if="casualtiesCalcFlag3 == '0'">
                      <el-button type="primary" @click="casualtiesCalc3" :disabled="!isEdit">③计算设定地震下人员伤亡</el-button>
                    </p>
                    <p v-else>
                      <el-button type="primary" @click="casualtiesCalc3" :disabled="!isEdit">③重新计算设定地震下人员伤亡</el-button>
                    </p>
                    <p v-if="casualtiesCalcFlag != '0' && casualtiesCalcFlag2 != '0' && casualtiesCalcFlag3 != '0'">
                      <el-button class="success-btn-icon" type="primary" plain
                        @click="influencefliedEarthquake('评估结果-人员伤亡')">
                        <el-icon>
                          <SuccessFilled />
                        </el-icon>地图查看结果
                      </el-button>
                    </p>
                  </el-col>
                  <el-col :span="6" class="calc-btn">
                    <p v-if="casualtiesCalcFlag != '0'">
                      <el-button type="primary" @click="exportCasualtiesCalc('/casualty/exportIntensityAndStructureOfArea','各烈度建筑物破坏结果.zip')">导出各烈度建筑物破坏结果</el-button>
                    </p>
                    <p v-if="casualtiesCalcFlag2 != '0'">
                      <el-button type="primary" @click="exportCasualtiesCalc('casualty/exportPbeInjuries','各烈度人员伤亡结果.zip')" >导出各烈度人员伤亡结果</el-button>
                    </p>
                  </el-col>
                </el-row>
              </li>
              <li>
                <h4>
                  <Title name="经济损失模型" id="selectModel-2" ref="selectModel-2" own="selectModel"></Title>
                </h4>
                <el-row align="top" :gutter="20">
                  <el-col :span="10" :lg="10" :xl="8">
                    <Card :data="economicData" :isEdit="isEdit" type="3"></Card>
                  </el-col>

                  <el-col :span="6" class="calc-btn">
                    <p>
                      <el-button type="primary" @click="economicCalc(0)" :disabled="!isEdit"
                        v-if="economicCalcFlag == '0'">①计算各烈度下经济损失分布</el-button>
                    </p>
                    <p>
                      <el-button type="primary" @click="economicCalc(0)" :disabled="!isEdit"
                        v-if="economicCalcFlag == '1'">①重新计算各烈度下经济损失分布</el-button>
                    </p>

                    <p>
                      <el-button type="primary" @click="economicCalc2" :disabled="!isEdit"
                        v-if="economicCalcFlag2 == '0'">②计算设定地震下经济损失</el-button>
                    </p>
                    <p>
                      <el-button type="primary" @click="economicCalc2" :disabled="!isEdit"
                        v-if="economicCalcFlag2 == '1'">②重新计算设定地震下经济损失</el-button>
                    </p>

                    <p v-if="economicCalcFlag == '1' && economicCalcFlag2 == '1'">
                      <el-button class="success-btn-icon" type="primary" plain
                        @click="influencefliedEarthquake('评估结果-经济损失')">
                        <el-icon>
                          <SuccessFilled />
                        </el-icon>地图查看结果
                      </el-button>
                    </p>
                  </el-col>

                  <el-col :span="6" class="calc-btn">
                    <p>
                      <el-button type="primary" @click="exportCasualtiesCalc('/economic/exportPbeLosses','各烈度经济损失结果.zip')" v-if="economicCalcFlag == '1'">导出各烈度经济损失结果</el-button>
                    </p>
                  </el-col>
                </el-row>
              </li>
              <li>
                <h4>
                  <Title name="需紧急安置人数模型" id="selectModel-3" ref="selectModel-3" own="selectModel"></Title>
                </h4>
                <el-row align="top" :gutter="20">
                  <el-col :span="10" :lg="10" :xl="8">
                    <Card :data="resettlementDefault" :isEdit="isEdit" type="7" label="1"
                      v-model:isChecked="radio.resettlementRadio">
                    </Card>
                  </el-col>
                  <el-col :span="10" :lg="10" :xl="8">
                    <Card :data="resettlementData" :isEdit="isEdit" type="4" label="2"
                      v-model:isChecked="radio.resettlementRadio">
                    </Card>
                  </el-col>

                  <el-col :span="4" class="calc-btn" :lg="6" :xl="6">
                    <p>
                      <el-button type="primary" @click="resettlementCalc(0)" :disabled="!isEdit"
                        v-if="resettlementFalg == '0'">①计算各烈度下需紧急安置人数分布</el-button>
                    </p>
                    <p>
                      <el-button type="primary" @click="resettlementCalc(0)" :disabled="!isEdit"
                        v-if="resettlementFalg == '1'">①重新计算各烈度下需紧急安置人数分布</el-button>
                    </p>

                    <p>
                      <el-button type="primary" @click="resettlementCalc2" :disabled="!isEdit"
                        v-if="resettlementFalg2 == '0'">②计算设定地震下需紧急安置人数</el-button>
                    </p>
                    <p>
                      <el-button type="primary" @click="resettlementCalc2" :disabled="!isEdit"
                        v-if="resettlementFalg2 == '1'">②重新计算设定地震下需紧急安置人数</el-button>
                    </p>

                    <p v-if="resettlementFalg == '1' && resettlementFalg2 == '1'">
                      <el-button class="success-btn-icon" type="primary" plain
                        @click="influencefliedEarthquake('评估结果-需紧急安置人数')">
                        <el-icon>
                          <SuccessFilled />
                        </el-icon>地图查看结果
                      </el-button>
                    </p>
                  </el-col>

                  <el-col :span="6" class="calc-btn">
                    <p>
                      <el-button type="primary" @click="exportCasualtiesCalc('/count/exportAzrs','需紧急安置人数结果.zip')" v-if="resettlementFalg == '1'">导出各烈度需紧急安置人数结果</el-button>
                    </p>
                  </el-col>
                </el-row>
              </li>
              <li>
                <h4>
                  <Title name="救援力量需求模型" id="selectModel-4" ref="selectModel-4" own="selectModel"></Title>
                </h4>
                <el-row align="top" :gutter="20">
                  <el-col :span="10" :lg="10" :xl="8">
                    <Card :data="rescueforceData" :isEdit="isEdit" type="5"></Card>
                  </el-col>
                  <el-col class="calc-btn" v-if="rescueforceFlag == '0'" :lg="2" :xl="2">
                    <p>
                      <el-button type="primary" @click="rescueforceCalc" :disabled="!isEdit">计算</el-button>
                    </p>
                  </el-col>
                  <el-col class="calc-btn" v-else-if="rescueforceFlag == '1'" :lg="4" :xl="4">
                    <p>
                      <el-button type="primary" @click="rescueforceCalc" :disabled="!isEdit">重新计算</el-button>
                    </p>
                    <p>
                      <el-button class="success-btn-icon" type="primary" plain
                        @click="influencefliedEarthquake('评估结果-需救援力量')">
                        <el-icon>
                          <SuccessFilled />
                        </el-icon>地图查看结果
                      </el-button>
                    </p>
                  </el-col>
                </el-row>
              </li>
              <li>
                <h4>
                  <Title name="救援物资需求模型" id="selectModel-5" ref="selectModel-5" own="selectModel"></Title>
                </h4>
                <el-row align="top" :gutter="20">
                  <el-col :span="10" :lg="10" :xl="8">
                    <Card :data="materialData" :isEdit="isEdit" type="6"></Card>
                  </el-col>
                  <el-col class="calc-btn" v-if="materialFlag == '0'" :lg="2" :xl="2">
                    <p>
                      <el-button type="primary" @click="materialCalc" :disabled="!isEdit">计算</el-button>
                    </p>
                  </el-col>
                  <el-col class="calc-btn" v-else-if="materialFlag == '1'" :lg="4" :xl="4">
                    <p>
                      <el-button type="primary" @click="materialCalc" :disabled="!isEdit">重新计算</el-button>
                    </p>
                    <p>
                      <el-button class="success-btn-icon" type="primary" plain
                        @click="influencefliedEarthquake('评估结果-需救援物资')">
                        <el-icon>
                          <SuccessFilled />
                        </el-icon>地图查看结果
                      </el-button>
                    </p>
                  </el-col>
                </el-row>
              </li>
            </ul>
          </div>

          <Title name="选择地震滑坡模型" id="landslideModel" ref="landslideModel"></Title>
          <div class="detail detail-left">
            <el-row align="top" :gutter="20">
              <el-col :span="10" :lg="10" :xl="8">
                <Card :data="logisticDefault" :isEdit="isEdit" type="8" label="1"
                  v-model:isChecked="radio.landslideRadio"></Card>
              </el-col>
              <el-col :span="10" :lg="10" :xl="8">
                <Card :data="loessPlateauDefault" :isEdit="isEdit" type="9" label="2"
                  v-model:isChecked="radio.landslideRadio"></Card>
              </el-col>
              <el-col class="calc-btn" :lg="5" :xl="5">
                <p v-if="EQLandslideFlag == '0'">
                  <el-button type="primary" @click="landslideCalc" :disabled="!isEdit">计算</el-button>
                </p>
                <p v-if="EQLandslideFlag != '0'">
                  <el-button type="primary" @click="landslideCalc" :disabled="!isEdit">重新计算</el-button>
                </p>
                <p v-if="EQLandslideFlag != '0'">
                  <el-button class="success-btn-icon" type="primary" plain
                    @click="influencefliedEarthquake('评估结果-震后交通情况分布图')">
                    <el-icon>
                      <SuccessFilled />
                    </el-icon>地图查看结果
                  </el-button>
                </p>
              </el-col>
            </el-row>
            <el-form :model="intensityForm" ref="intensityRef" :inline="true">
              <el-form-item label="烈度：" label-width="80px" prop="dzIntensity"
                :rules="[{ required: true, message: '请选择烈度！' }]">
                <el-select v-model="intensityForm.dzIntensity" placeholder="请选择" style="width: 100%;" :disabled="!isEdit">
                  <el-option v-for="(key, val) in optionType.intensity" :key="key" :label="key" :value="val">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="考虑对道路影响的范围（m）：" label-width="300px" prop="parameter"
                :rules="[{ required: true, message: '请填写考虑对道路影响的范围！', trigger: 'change' }]">
                <el-input v-model="intensityForm.parameter" :disabled="!isEdit"></el-input>
              </el-form-item>
              <el-row>
                <el-col :span="8" v-if="radio.landslideRadio == '2'">
                  <el-form-item label="坡度数据:" prop="slopeVersion"
                    :rules="[{ required: true, message: '请选择坡度数据！', trigger: 'change' }]">
                    <el-button plain v-if="!intensityForm.slopeVersion" @click="selectSlope">选择</el-button>
                    <el-link v-else type="primary" :underline="false" @click="selectSlope">{{ intensityForm.slopeVersion
                    }}</el-link>
                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="radio.landslideRadio == '2'">
                  <el-form-item label="地层岩性:" prop="lithologyVersion"
                    :rules="[{ required: true, message: '请选择地层岩性！', trigger: 'change' }]">
                    <el-button plain v-if="!intensityForm.lithologyVersion" @click="selectLithology">选择</el-button>
                    <el-link v-else type="primary" :underline="false" @click="selectLithology">{{
                      intensityForm.lithologyVersion
                    }}</el-link>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row v-if="radio.landslideRadio == '2'">
                <el-col :span="8">
                  <el-form-item label="地貌数据:" prop="landformsVersion"
                    :rules="[{ required: true, message: '请选择地貌数据！', trigger: 'change' }]">
                    <el-button plain v-if="!intensityForm.landformsVersion" @click="selectLandforms">选择</el-button>
                    <el-link v-else type="primary" :underline="false" @click="selectLandforms">{{
                      intensityForm.landformsVersion
                    }}</el-link>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="天然密度数据:" prop="densityVersion"
                    :rules="[{ required: true, message: '请选择天然密度数据！', trigger: 'change' }]">
                    <el-button plain v-if="!intensityForm.densityVersion" @click="selectDensity">选择</el-button>
                    <el-link v-else type="primary" :underline="false" @click="selectDensity">{{
                      intensityForm.densityVersion
                    }}</el-link>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </div>

          <Title name="评估及结果修正" id="assessment" ref="assessment"></Title>
          <Assessment :tableData="assessmentList" :isEdit="isEdit" @saveAssessmentResults="saveAssessmentResults"
            @getAssessmentResults="getAssessmentResults" @handleExportResults="handleExportResults" v-load="loadMore" :isShowAppend="isShowAppend"
            :isShowEnd="isShowEnd"></Assessment>
        </div>
      </el-col>
      <el-col class="tree" ref="tree" :span="5" :lg="5" :xl="4">
        <el-affix :offset="160">
          <ScrollBetter ref="scrollBetter" :treeData="treeData" @updateScroll="updateScroll"></ScrollBetter>
        </el-affix>
      </el-col>
    </el-row>
    <!-- 设定地震-生成地震明细弹框 -->
    <SetEQDetail v-model:open="setEQDetailOpen" :longitude="longitude" :latitude="latitude" :taskId="setEQTaskId"
      @getSetEQCensus="getSetEQCensus"></SetEQDetail>
    <!-- 建筑易损性-选择 -->
    <SelectBuildVulnerability v-model:open="selectBuildVulnerabilityOpen" :data="dialogData"
      @updateVulnerability="updateMatrixList"></SelectBuildVulnerability>
    <!-- 查看详细评估结果弹窗 -->
    <AssessmentResultsDetails v-model:open="assessmentResultsDetailsOpen"></AssessmentResultsDetails>
    <!-- </div> -->
    <!-- </div> -->
    <!-- 打开坡度数据选择对话框 -->
    <el-dialog title="选择版本" v-model="openSlope" width="1000px" append-to-body>
      <p></p>
      <el-form :model="queryParamsSel" ref="querySelRef" :inline="true" v-show="showSearch" label-width="120px">
        <el-form-item label="版本说明" prop="versionDesc">
          <el-input v-model="queryParamsSel.versionDesc" clearable />
        </el-form-item>
        <el-form-item label="上传人" prop="uploadUser">
          <el-input v-model="queryParamsSel.uploadUsername" clearable />
        </el-form-item>
        <el-form-item label="上传日期">
          <el-col :span="10">
            <el-date-picker type="date" placeholder="选择日期" v-model="queryParamsSel.uploadStartTime"
              value-format="YYYY-MM-DD" style="width: 100%;"></el-date-picker>
          </el-col>
          <el-col class="line" :span="2" style="text-align: center">至</el-col>
          <el-col :span="10">
            <el-date-picker type="date" placeholder="选择日期" v-model="queryParamsSel.uploadEndTime"
              value-format="YYYY-MM-DD" style="width: 100%;"></el-date-picker>
          </el-col>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="Search" @click="handleQuerySel">搜索</el-button>
          <el-button plain icon="Refresh" @click="resetQuerySel">重置</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="loadingSel" ref="tableRef" :data="slopeDataList">
        <el-table-column type="expand" width="1">
          <template #default="props">
            <div class="expandTable">
              <h3>更多信息</h3>
              <p>数据名称: {{ props.row.dataName }}</p>
              <p>版本说明: {{ props.row.versionDesc }}（此处是版本说明，<span style="color:red">限制300字以内</span> ）</p>
              <p>数据说明: {{ props.row.dataDesc }}（此处是数据说明，<span style="color:red">限制300字以内</span> ）</p>
              <!--<p v-if="props.row.updateDesc">更新说明: {{ props.row.dataType }}</p>
            <p>使用系统: {{ props.row.useThisSystems }}
              <el-tooltip class="box-item" content="Right Center prompts info" placement="right">
                <el-tag>系统使用说明</el-tag>
              </el-tooltip>
            </p>
            <p>数据文件:
              <template v-for="item in props.row.dataFileList">
                <u style="color:var(--el-color-primary);cursor: pointer;" @click="handleDownload(item)">{{ item.name }}</u><br />
              </template>
            </p>
            <p>附件:
              <template v-for="item in props.row.attachmentList">
                <u style="color:var(--el-color-primary);cursor: pointer;" @click="handleDownload(item)">{{ item.name }}</u><br />
              </template>
            </p>-->
            </div>
          </template>
        </el-table-column>
        <el-table-column label="版本日期" align="center" prop="versionTime">
          <!--<template #default="scope">
						<el-button type="text" @click="edit(scope.row)">{{ scope.row.modelName }}
						</el-button>
					</template>-->
        </el-table-column>
        <el-table-column label="版本号" align="center" prop="versionCode" width="200" />
        <el-table-column label="版本级别（版本范围）" align="center" prop="dataRange" width="220" />
        <el-table-column label="上传日期" align="center" prop="uploadTime" />
        <el-table-column label="上传人" align="center" prop="uploadUser" />
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template #default="scope">
            <el-space>
              <el-link type="primary" :underline="false" @click="handleMore(scope.row)">更多信息</el-link>
              <el-link type="primary" :underline="false" @click="handleSelect(scope.row)">选择</el-link>
            </el-space>
          </template>
        </el-table-column>
      </el-table>

      <pagination v-show="totalSel > 0" :total="totalSel" v-model:page="queryParamsSel.page"
        v-model:limit="queryParamsSel.rows" @pagination="getSlopeDataList" />

      <template #footer>
        <div class="dialog-footer">
          <el-button plain @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
    <!-- 上传进度展示 -->
    <el-dialog v-model="openCreate" title="正在计算" width="400px" :close-on-click-modal="false" append-to-body
      :show-close="false">
      <p></p>
      <div class="demo-progress">
        <el-progress :percentage="percentages" />
      </div>
      <!--<div class="footer">
          <el-button plain @click="cancelUpload">取消生成</el-button>
      </div>-->
    </el-dialog>
  </el-scrollbar>
</template>
<script setup>
import Card from './Components/Card/Card.vue'
import Title from './Components/Title.vue'
import ScrollBetter from './Components/ScrollBetter.vue'
import SetEQDetail from './Dialog/setEQDetail.vue'
import SelectBuildVulnerability from './Dialog/selectBuildVulnerability.vue'
import Assessment from './Components/Assessment.vue'
import AssessmentResultsDetails from './Dialog/assessmentResultsDetails.vue'
import {
  getPreAssessTaskInfo, getSubTask,
  intensityRelation, countEqIntensity, saveSettingSeismicProcess,
  isHaveSetEarthquake, setEarthquakeCensus, setEarthquakeDelete, getSettingSeismicDetailsByTaskId, assignment,
  matrixList, matrixChoiceList, matrixSee, seiCapCalculation, countIntensityAndStructureOfArea,
  savePbeInjuries, casualtiesCalculate, savePbeLosses, economicCalculate,
  AzMath, AzCount, newCalculate, countRescueForce, countMaterial, countLandslide,
  seiCapCalOfBuilding, createFinalValue, getAllResult, getAllNoPage, updateResult,
  influencefliedUpload, getSlopeData, getVersionListData, getBusinessVersionListData, count2, updateEarthquakeCensus,
  getRangeByTaskId, deleteDateByTaskId
} from '@/api/earthquakeLossesEstimation/earthquakeSetting'
import { ElMessage, ElMessageBox } from 'element-plus'
import useTagsViewStore from '@/store/modules/tagsView.js'
const tagsViewStore = useTagsViewStore()

const isSlopeShowButton = ref(true);
const isLithologyShowButton = ref(true);
const isLandformsShowButton = ref(true);
const isDensityShowButton = ref(true);
const slopeVersion = ref("");
const lithologyVersion = ref("");
const landformsVersion = ref("");
const densityVersion = ref("");
const openSlope = ref(false);
const showSearch = ref(true);
const totalSel = ref(0);
const loadingSel = ref(true);
const slopeDataList = ref([]);
const openCreate = ref(false);
const percentages = ref();
const data = reactive({
  taskInfo: {
    taskNum: '',
    groupName: '',
    taskManager: '',
    groupLeader: '',
    groupMember: '',
    groupExpert: '',
    parentTask: '',
    taskStatus: '',
    assessmentUserId: '',
    assessmentUserDept: '',
    assessmentTime: ''
  },
  queryParamsSel: {
    page: 1,
    rows: 10,
  },
  treeData: []
})

const { taskInfo, treeData, queryParamsSel } = toRefs(data)
const isEdit = computed(() => {
  return taskInfo.value.taskStatus == '0' || taskInfo.value.taskStatus == '1'
})
const loading = ref(false)
const radio = reactive({
  resettlementRadio: '1',
  landslideRadio: '1'
})
const setEQ = ref('1')
const optionCode = reactive({
  'mercalliScale': { 'Ⅹ': 'Ⅹ', 'Ⅸ': 'Ⅸ', 'Ⅷ': 'Ⅷ', 'Ⅶ': 'Ⅶ', 'Ⅵ': 'Ⅵ' },
  'intensity1': { 'Ⅵ': 'Ⅵ', 'Ⅶ': 'Ⅶ', 'Ⅷ': 'Ⅷ', 'Ⅸ': 'Ⅸ', 'Ⅹ': 'Ⅹ', 'Ⅺ': 'Ⅺ' },
  'intensity2': { 'Ⅵ': 'Ⅵ', 'Ⅶ': 'Ⅶ', 'Ⅷ': 'Ⅷ', 'Ⅸ': 'Ⅸ', 'Ⅹ': 'Ⅹ' }
})
const optionType = reactive({
  mercalliScale: optionCode.mercalliScale,
  intensity: {}
})

const influenceieldList = reactive([
  { x1: 'PGA', x2: '浮点型', x3: '否', x4: '0.10792571828' },
  { x1: 'PGV', x2: '浮点型', x3: '否', x4: '0.010026525409' },
  { x1: 'PGV_vs30', x2: '浮点型', x3: '否', x4: '0.0076093997977' },
  { x1: 'intensity', x2: '文本', x3: '是', x4: 'Ⅶ' }
])
const { proxy } = getCurrentInstance()
const route = useRoute()
const { taskId, taskType, pattern, metaTitle } = route.query
let curTaskType = pattern


const detail = ref()
const scrollData = reactive({
  curHeight: 0,
  totalHeight: 1
})
onMounted(() => {
  getTaskInfo()
  getRange()
  getAllModel()
  getSetEQCensus()
  // getMatrixList()
  getAssessmentList()
  getScrollData()
  if(scrollData.curHeight == 0){
    scrollBetter.value.addActive('taskDetail')
  }
})


// 获取右侧数据
const getScrollData = () => {
  treeData.value = []
  let hasRef = []
  for (let key in proxy.$refs) {
    proxy.$refs[key].curTitleInfo && hasRef.push(proxy.$refs[key].curTitleInfo)
  }
  let sortRef = []
  let ownRef = []
  hasRef.map(item => {
    if (item.own) {
      ownRef.push(item)
    } else {
      sortRef.push(item)
    }
  })
  sortRef = [...sortRef, ...ownRef]
  sortRef.map(cur => {
    if (!cur.own) {
      treeData.value.push(cur)
    } else {
      treeData.value.forEach(item => {
        item.children = item.children?.length > 0 ? item.children : []
        if (item.id == cur.own) {
          if (!item.children.includes(cur)) {
            item.children.push(cur)
            item.children.sort((a, b) => {
              return a.id.split('-')[1] - b.id.split('-')[1]
            })
          }
        }
      })
    }
  })
  // for (let key in proxy.$refs) {
  //   let cur = proxy.$refs[key].curTitleInfo
  //   if (cur) {
  //     if (!cur.own) {
  //       treeData.value.push(proxy.$refs[key].curTitleInfo)
  //     } else {
  //       treeData.value.forEach(item => {
  //         item.children = item.children?.length > 0 ? item.children : []
  //         if (item.id == cur.own) {
  //           if (!item.children.includes(cur)) {
  //             item.children.push(cur)
  //             item.children.sort((a, b) => {
  //               return a.id.split('-')[1] - b.id.split('-')[1]
  //             })
  //           }
  //         }
  //       })
  //     }
  //   }
  // }
}

// 拿标题的高度
const getTitleInfo = () => {
  let titleInfo = []
  treeData.value.map(item => {
    let refName = item.id
    proxy.$refs[refName].getTitleHeight()
    let curTitleInfo = proxy.$refs[refName].curTitleInfo
    titleInfo.push(curTitleInfo)
    if (item.children?.length > 0) {
      item.children.map(itemChild => {
        let refChildrenName = itemChild.id
        proxy.$refs[refChildrenName].getTitleHeight()
        let curChildTitleInfo = proxy.$refs[refChildrenName].curTitleInfo
        titleInfo.push(curChildTitleInfo)
      })
    }
  })
  return titleInfo
}
// 滚动
const scrollBetter = ref()
const scrollbarRef = ref()
const scroll = ({ scrollTop }) => {
  // const scroll = (event) => {
  // let scrollTop = event.target.scrollTop

  let titleInfo = getTitleInfo()
  scrollData.totalHeight = detail.value.$el.clientHeight
  scrollData.curHeight = scrollTop
  titleInfo.reduce((prev, cur) => {
    if(scrollData.curHeight == 0){
      scrollBetter.value.addActive('taskDetail')
    }
    if (scrollData.curHeight == prev.titleHeight) {
      scrollBetter.value.addActive(prev.id)
    } else if (scrollData.curHeight == cur.titleHeight) {
      scrollBetter.value.addActive(cur.id)
    } else if (scrollData.curHeight > prev.titleHeight && scrollData.curHeight < cur.titleHeight) {
      if (scrollData.curHeight - cur.titleHeight >= -50) {
        scrollBetter.value.addActive(cur.id)
      }
    }
    return cur
  }, {titleHeight: 0})
}
const updateScroll = (id) => {
  proxy.$refs[id].getTitleHeight()
  let curTitleInfo = proxy.$refs[id].curTitleInfo
  scrollbarRef.value?.setScrollTop(curTitleInfo.titleHeight)
}

// 获取任务详情
const getTaskInfo = () => {
  getPreAssessTaskInfo(taskId).then(res => {
    taskInfo.value = res.data
    if (res.data.parentId == '0') {
      getSubTask(res.data.id).then(response => {
        if (response.data.length > 0) {
          // 有子任务
          curTaskType = '1'
          // console.log('有子任务1', taskType == '0')
        } else {
          // 无子任务
          curTaskType = '2'
          // console.log('无子任务2', taskType == '0', curTaskType)
        }
      })
    } else {
      // 子任务
      curTaskType = '3'
      // console.log('子任务3', taskType == '0')
    }
  })
}
// 获取选择计算范围
const getRange = () => {
  getRangeByTaskId(taskId).then(res => {
    if (res.code == 200) {
      calculateRange.value = res.data
    }
  })
}

// 设定地震
const setEQData = reactive({
  setEarthquakeList: [],
  setEQDetailOpen: false,
  longitude: 0,
  latitude: 0,
  deleteIds: ''
})
const { setEarthquakeList, setEQDetailOpen, longitude, latitude, deleteIds } = toRefs(setEQData)
const groupNum = computed(() => {
  return setEarthquakeList.value.length
})
const totalNum = computed(() => {
  return setEarthquakeList.value.reduce((prev, cur) => {
    return prev + cur.count
  }, 0)
})
// 设定地震-分配子任务
const setEQAssignment = () => {
  loading.value = true
  // isHaveSetEarthquake(taskId).then(res => {
  // false为没有设定地震，刷新当前页面不可再设定地震；
  // true为有设定地震，刷新当前页面不可再设定地震和删除；
  // const confirmMessage = res.data ? '请确认是否将设定地震按震中位置所在省分配给各子任务?' : '当前未生成设定地震，断层设定地震及公里格网设定地震仅能由任务管理员进行设定，分配给子任务后仅能点状设定地震，请确认是否分配给子任务？'
  // proxy.$modal.confirm(confirmMessage).then(() => {
  // 将设定地震按震中位置所在省分配给各子任务，并提示分配成功，刷新当前页面不可再设定地震。
  assignment(taskId).then(res => {
    if (res.code == 200) {
      loading.value = false
      ElMessage({
        message: '分配成功！',
        type: 'success',
        duration: 1000,
        onClose: function () {
          let tabs = tagsViewStore.visitedViews
          proxy.$tab.closePage(tabs[tabs.length - 1]);
          router.push({ name: "earthquakeDetail", query: { metaTitle, taskId, taskType: '0', pattern: curTaskType } })
        }
      })
    }
  }).catch(() => { loading.value = false })
  // })
  // })
}
// 设定地震-设定地震列表
const getSetEQCensus = () => {
  setEarthquakeCensus(taskId).then(res => {
    if (res.code == 200) {
      setEarthquakeList.value = res.data
    }
  })
}
// 设定地震-查看明细弹框
const setEQTaskId = ref('')
const viewSetEQDetail = (row) => {
  setEQDetailOpen.value = true
  longitude.value = row.longitude
  latitude.value = row.latitude
  setEQTaskId.value = row.taskId
}
// 设定地震-删除
const deleteSetEQDetail = (faultNum) => {
  deleteHandler(faultNum)
}
// 设定地震-批量删除
const selectSetEQ = (selection) => {
  let ids = selection.map(item => {
    return item.faultNum
  })
  deleteIds.value = ids.join(',')
}
const batchDelete = () => {
  deleteHandler(deleteIds.value)
}
// 设定地震-删除请求
const deleteHandler = ids => {
  if (!ids) {
    proxy.$modal.msgError('未选中任何删除数据！')
    return
  }
  proxy.$modal.confirm('是否确认删除？').then(() => {
    setEarthquakeDelete({ taskId, faultNum: ids }).then(res => {
      if (res.code == 200) {
        proxy.$modal.msgSuccess('删除成功！')
        getSetEQCensus()
      }
    })
  }).catch(err => { })
}
// 设定地震-更新设定地震序号
const updateEQNum = () => {
  updateEarthquakeCensus({taskId}).then(res => {
    console.log(res)
    if(res.code == 200){
      proxy.$modal.msgSuccess('更新序号成功,如已生成影响场及评估计算，修改设定地震后请重新生成影响场及重新计算！')
      getSetEQCensus()
    }
  })
}

// 选择计算范围
const calculateRange = ref('0')
const calculateRangeChange = (val) => {
  // 判断是否已有影响场结果，如果有，则提示”修改计算范国需重新生成影响场并重新计算，请确认是否修改?“选择是，则清空计算结果
  let flag = false
  if(setEQ.value != '3') {
    // intensityType == '1' 已生成
    if(intensityType.value == '1') {
      flag = true
    }
  }else{
    // settingSeismicDetails.value.length>0  importFlag == '1'
    let importFalg = settingSeismicDetails.value?.every(item => item.importFlag == '1')
    if(settingSeismicDetails.value.length > 0 && importFalg) {
      flag = true
    }
  }
  if(flag) {
    proxy.$modal.confirm('修改计算范国需重新生成影响场并重新计算，请确认是否修改?').then(() => {
      // 清空计算结果
      deleteDateByTaskId(taskId).then(res => {
        if(res.code == 200) {
          // proxy.$modal.msgSuccess('修改成功！')
          // getRange()
          getAllModel()
          getAssessmentList()
        }
      })
    }).catch(() => {
      calculateRange.value = val == '0' ? '1' : '0'
    })
  }
}

// 生成地震影响场
let mercalliScaleOrigin = [
  { intensity: 'Ⅹ', longAxis: '', shortAxis: '' },
  { intensity: 'Ⅸ', longAxis: '', shortAxis: '' },
  { intensity: 'Ⅷ', longAxis: '', shortAxis: '' },
  { intensity: 'Ⅶ', longAxis: '', shortAxis: '' },
  { intensity: 'Ⅵ', longAxis: '', shortAxis: '' }
]
const mercalliScaleRef = ref()
const mercalliScale = reactive({
  select: '',
  list: mercalliScaleOrigin
})
// 是否生成地震影响场
const isHaveSetEQ = ref(true)
const checkList = (rule, value, callback) => {
  let isFull = value.every(item => {
    return item.longAxis != '' && item.shortAxis != ''
  })
  if (isFull) {
    callback()
  } else {
    callback(new Error("请将地震影响场长短轴长度填写完整!"))
  }
}
const mercalliScaleRules = reactive({
  select: [{ required: true, message: '请选择震中烈度', trigger: 'change' }],
  list: [{ validator: checkList }]
})
optionType.intensity = computed(() => {
  if (radio.landslideRadio == '1') {
    return optionCode.intensity1
  } else if (radio.landslideRadio == '2') {
    return optionCode.intensity2
  }
})
// 生成地震影响场-震中烈度切换
const mercalliScaleChange = (val) => {
  mercalliScaleOrigin = mercalliScaleOrigin.map(item => {
    return {
      intensity: item.intensity,
      longAxis: '',
      shortAxis: ''
    }
  })
  mercalliScale.list = mercalliScaleOrigin.slice(0)
  let index = mercalliScale.list.findIndex(item => item.intensity == val)
  mercalliScale.list.splice(0, index)
}
// type1 = 1,代表1生成地震影响场；type2 = 2代表2生成了地震影响场
const modelData = reactive({
  intensityData: {},
  intensityType: '',
  buildVulnerabilityFlag: '0',
  buildVulnerabilityFlag2: '0',
  buildVulnerabilityFlag3: '0',
  differenceFlag: '0',
  casualtiesCalcFlag: '0',
  casualtiesCalcFlag2: '0',
  casualtiesCalcFlag3: '0',
  casualtiesData: {},
  economicCalcFlag: '0',
  economicCalcFlag2: '0',
  economicData: {},
  resettlementDefault: {
    type: 'default',
    modelName: '需紧急安置人数默认模型',
    createUserName: '系统默认',
    orgName: '系统默认',
    updateTime: '2022-11-08',
    createTime: '2022-11-08',
    range: '需满足人口普查数据、人口和建筑概况数据均完备时使用'
  },
  resettlementData: {},
  resettlementFalg: '0',
  resettlementFalg2: '0',
  rescueforceData: {},
  rescueforceFlag: '0',
  materialData: {},
  materialFlag: '0',
  logisticDefault: {
    type: 'default',
    modelName: '逻辑斯蒂滑坡模型',
    createUserName: '系统默认',
    orgName: '系统默认',
    updateTime: '2022-11-08',
    createTime: '2022-11-08',
    range: '需满足坡度数据完备时使用'
  },
  loessPlateauDefault: {
    type: 'default',
    modelName: '黄土高原滑坡模型',
    createUserName: '系统默认',
    orgName: '系统默认',
    updateTime: '2022-11-08',
    createTime: '2022-11-08',
    range: '需满足地震地质灾害子系统中地貌、天然密度气象数据完备时使用'
  },
  EQLandslideFlag: '0'
})
const { intensityData, intensityType, buildVulnerabilityFlag, buildVulnerabilityFlag2, buildVulnerabilityFlag3, differenceFlag,
  casualtiesData, casualtiesCalcFlag, casualtiesCalcFlag2, casualtiesCalcFlag3, economicData, economicCalcFlag, economicCalcFlag2,
  resettlementDefault, resettlementData, resettlementFalg, resettlementFalg2, rescueforceData, rescueforceFlag,
  materialData, materialFlag, logisticDefault, loessPlateauDefault, EQLandslideFlag } = toRefs(modelData)

// 获取所有模型及地震影响场的回显
const curSetEQ = ref('')
const getAllModel = () => {
  intensityRelation(taskId).then(res => {
    const { code, data } = res
    if (code == 200) {
      // 地震影响场
      intensityData.value = data.entity1[0]
      casualtiesData.value = data.entity2
      economicData.value = data.entity3
      resettlementData.value = data.entity4
      rescueforceData.value = data.entity5
      materialData.value = data.entity6

      if (!data.seismicIntensityRelation) {
        // setEQ.value = '0';
        
        isHaveSetEQ.value = true
        intensityType.value = '0';
        setEQ.value = '1';
        curSetEQ.value = '1';

        casualtiesCalcFlag.value = '0';
        casualtiesCalcFlag2.value = '0';
        casualtiesCalcFlag3.value = '0';

        economicCalcFlag.value = '0'
        economicCalcFlag2.value = '0'

        resettlementFalg.value = '0'
        resettlementFalg2.value = '0'
        radio.resettlementRadio = '1'

        rescueforceFlag.value = '0'

        materialFlag.value = '0'

        buildVulnerabilityFlag.value = '0'
        buildVulnerabilityFlag2.value = '0'
        buildVulnerabilityFlag3.value = '0'

        differenceFlag.value = '0'

        radio.landslideRadio = '1';
        intensityForm.dzIntensity = '';
        intensityForm.parameter = '';
        intensityForm.slopeVersion = '';
      } else {


        intensityType.value = data.seismicIntensityRelation.button1_status1 || '0'
        if (!data.seismicIntensityRelation.model1Type) {
          setEQ.value = '1';
          curSetEQ.value = '1';
        } else {
          setEQ.value = data.seismicIntensityRelation.model1Type;
          curSetEQ.value = data.seismicIntensityRelation.model1Type;
        }
        if (setEQ.value == '3') {
          getSettingSeismicDetails()
        }
        if (!data.seismicIntensityRelation.model1Type || data.seismicIntensityRelation.model1Type == 1 || data.seismicIntensityRelation.model1Type == 2) {
          isHaveSetEQ.value = true
        } else {
          isHaveSetEQ.value = false
        }
        // 地震影响场模型回显
        if (data.seismicIntensityRelation.model1Type == '2') {
          const { entity1 } = data
          // 数据回显可能需要修改
          mercalliScale.select = entity1[1].epicenterIntensity
          mercalliScale.list = mercalliScale.list.filter(item => {
            switch (item.intensity) {
              case 'Ⅹ':
                item.longAxis = entity1[1].longLength5
                item.shortAxis = entity1[1].shortLength5
                break
              case 'Ⅸ':
                item.longAxis = entity1[1].longLength4
                item.shortAxis = entity1[1].longLength4
                break
              case 'Ⅷ':
                item.longAxis = entity1[1].longLength3
                item.shortAxis = entity1[1].longLength3
                break
              case 'Ⅶ':
                item.longAxis = entity1[1].longLength2
                item.shortAxis = entity1[1].longLength2
                break
              case 'Ⅵ':
                item.longAxis = entity1[1].longLength1
                item.shortAxis = entity1[1].longLength1
                break
            }
            if (item.longAxis != null && item.shortAxis != null) {
              return item
            }
          })
        }
        // 人员伤亡模型
        // casualtiesData.value = data.entity2
        casualtiesCalcFlag.value = data.seismicIntensityRelation.button2_status1 || '0';
        casualtiesCalcFlag2.value = data.seismicIntensityRelation.button2_status2 || '0';
        casualtiesCalcFlag3.value = data.seismicIntensityRelation.button2_status3 || '0';
        // 经济损失模型
        // economicData.value = data.entity3
        economicCalcFlag.value = data.seismicIntensityRelation.button3_status1 || '0'
        economicCalcFlag2.value = data.seismicIntensityRelation.button3_status2 || '0'
        // 需紧急安置模型
        // resettlementData.value = data.entity4
        resettlementFalg.value = data.seismicIntensityRelation.button4_status1 || '0'
        resettlementFalg2.value = data.seismicIntensityRelation.button4_status2 || '0'
        radio.resettlementRadio = data.seismicIntensityRelation.model4Type ? data.seismicIntensityRelation.model4Type : '1'
        // 救援力量需求模型
        // rescueforceData.value = data.entity5
        rescueforceFlag.value = data.seismicIntensityRelation.button5_status1 || '0'
        // 物资需求模型
        // materialData.value = data.entity6
        materialFlag.value = data.seismicIntensityRelation.button5_status1 || '0'
        // 建筑物抗震能力分布
        buildVulnerabilityFlag.value = data.seismicIntensityRelation.button8_status1 || '0'
        buildVulnerabilityFlag2.value = data.seismicIntensityRelation.button8_status2 || '0'
        buildVulnerabilityFlag3.value = data.seismicIntensityRelation.button8_status3 || '0'
        // 区县致死性差异性分析
        differenceFlag.value = data.seismicIntensityRelation.button9_status1 || '0'
        // 地震滑坡模型
        EQLandslideFlag.value = data.seismicIntensityRelation.button7_status1 || '0'

        intensityForm.dzIntensity = data.entity7?.dzIntensity || ''
        intensityForm.parameter = data.entity7?.roadRange.toString() || ''
        intensityForm.slopeVersion = data.entity7?.slopeVersion || ''
        intensityForm.lithologyVersion = data.entity7?.lithologyVersion || ''
        intensityForm.landformsVersion = data.entity7?.phyVersion || ''
        intensityForm.densityVersion = data.entity7?.natDenVersion || ''
        radio.landslideRadio = data.entity7?.resultSource || '1'
      }
    }
  })
}

provide('modelData', modelData)
// 生成地震影响场
const creatEqIntensity = (setEQ) => {
  if (groupNum.value == 0) {
    proxy.$modal.msgError('请先生成设定地震！');
    return
  }
  if (setEQ == 1) {
    const data = { taskId, modelId: intensityData.value.id, range: calculateRange.value }
    loading.value = true
    countEqIntensity(data).then(res => {
      loading.value = false
      if (res.code == 200 && res.data == '计算地震影响场生成成功！') {
        proxy.$modal.msgSuccess(res.data);
        intensityType.value = '1'
        // 建筑易损性矩阵列表刷新
        // getMatrixList()
        // 更新评估结果
        getAssessmentList()
        getAllModel()
      }
    }).catch(err => {
      loading.value = false;
    })
  } else if (setEQ == 2) {
    let data = {}
    data.epicenterIntensity = mercalliScale.select
    mercalliScale.list.map(item => {
      switch (item.intensity) {
        case 'Ⅹ':
          data.longLength5 = item.longAxis
          data.shortLength5 = item.shortAxis
          break
        case 'Ⅸ':
          data.longLength4 = item.longAxis
          data.shortLength4 = item.shortAxis
          break
        case 'Ⅷ':
          data.longLength3 = item.longAxis
          data.shortLength3 = item.shortAxis
          break
        case 'Ⅶ':
          data.longLength2 = item.longAxis
          data.shortLength2 = item.shortAxis
          break
        case 'Ⅵ':
          data.longLength1 = item.longAxis
          data.shortLength1 = item.shortAxis
          break
      }
    })
    mercalliScaleRef.value.validate(valid => {
      if (valid) {
        loading.value = true
        saveSettingSeismicProcess({ taskId, entity: data, range: calculateRange.value }).then(res => {
          loading.value = false
          if (res.code == 200) {
            proxy.$modal.msgSuccess("生成地震影响场成功！");
            intensityType.value = '1'
            // 建筑易损性矩阵列表刷新
            // getMatrixList()
            // 更新评估结果
            getAssessmentList()
          }
        })
      }
    }).catch(() => loading.value = false )
  }
}
const radioChange = (val) => {
  if (val == '3') {
    getSettingSeismicDetails()
  }
}
const settingSeismicDetails = ref([])
const settingSeismicLoading = ref(true)
// 获取导入地震影响场列表
const getSettingSeismicDetails = () => {
  getSettingSeismicDetailsByTaskId(taskId).then(res => {
    if (res.code = 200) {
      settingSeismicDetails.value = res.data
      settingSeismicLoading.value = false
    }
  })
}

// 建筑易损性
const matrixData = reactive({
  params: {
    taskId,
    page: 1,
    rows: 10
  },
  buildVulnerabilityLoading: true,
  buildVulnerabilityList: [],
  buildVulnerabilityTotal: 0,
  loading: false,
  selectBuildVulnerabilityOpen: false,
  dialogData: {}
})
const { params, buildVulnerabilityLoading, buildVulnerabilityList, buildVulnerabilityTotal, selectBuildVulnerabilityOpen, dialogData } = toRefs(matrixData)
// 获取建筑易损性矩阵-列表
const getMatrixList = () => {
  matrixData.loading = true
  matrixList(params.value).then(res => {
    matrixData.loading = false
    if (res.code == 200) {
      buildVulnerabilityLoading.value = false
      buildVulnerabilityList.value = res.data.rows
      buildVulnerabilityTotal.value = res.data.total
    }
  }).catch(err => {
    matrixData.loading = false
  })
}
const updateMatrixList = (updateIndex) => {
  const updateItem = buildVulnerabilityList.value[updateIndex]
  updateItem.seeOrChoice = '1'
  buildVulnerabilityList.value.splice(updateIndex, 1, updateItem)
}
// 选择
const selectBuildVulnerability = (row, index) => {
  const { province, city, county } = row
  const range = province + city + county
  matrixChoiceList({ province, city, prefecture: county }).then(res => {
    if (res.code == 200) {
      if (res.data.length == 0) {
        proxy.$modal.alertError(`系统未匹配到${range}建筑物易损性数据，请到【数据管理-建筑物易损性数据】模块中维护。`)
      } else {
        if (res.message != '查询成功') {
          ElMessageBox.alert(res.message, '系统提示', { type: 'error', dangerouslyUseHTMLString: true })
        } else {
          selectBuildVulnerabilityOpen.value = true
          dialogData.value = {
            index,
            parentData: row,
            tableData: res.data
          }
        }
      }
    }
  })
}
// 查看
const viewBuildVulnerability = (row) => {
  const { province, city, county } = row
  matrixSee({ province, city, prefecture: county, taskId }).then(res => {
    if (res.code == 200) {
      selectBuildVulnerabilityOpen.value = true
      dialogData.value = {
        parentData: row,
        isView: 'view',
        tableData: res.data
      }
    }
  })
}
// 生成建筑物抗震能力分布
const saveSeiCapCalOfBuilding = async (type) => {
  //loading.value = true
  if (typeof cancelFunc.c === "function") {
    cancelFunc.c('取消成功')
  }
  percentages.value = 0;
  openCreate.value = true;

  let startTime = setInterval(() => {
    if (percentages.value < 50) {
      percentages.value += 5;
    }
    if (percentages.value == 50) {
      clearInterval(startTime);
      let conductTime = setInterval(() => {
        if (percentages.value == 95) {
          clearInterval(conductTime);
        }
        if (percentages.value < 96) {
          percentages.value += 2;
        }
      }, 100)
    }
  }, 100)
  seiCapCalculation(taskId, type).then(res => {
    if (res.code == 200) {
      percentages.value = 100;
      openCreate.value = false;
      switch (type) {
        case 0:
          buildVulnerabilityFlag.value = '1'
          proxy.$modal.msgSuccess("生成区县建筑物抗震能力分布成功！");
          break;
        case 1:
          buildVulnerabilityFlag2.value = '1'
          proxy.$modal.msgSuccess("生成乡镇建筑物抗震能力分布成功！");
          break;
        case 2:
          buildVulnerabilityFlag3.value = '1'
          proxy.$modal.msgSuccess("生成公里格网建筑物抗震能力分布");
          break;
      }
      // 更新评估结果
    }
  }).catch(err => {
    //loading.value = false
    openCreate.value = false
    if (err.message !== '取消成功') {
      cancelFunc.c = null
    }
  })
}

// 导出建筑物抗震能力分布
const exportSeiCapCalOfBuilding = async (type) => {
  proxy.downloadZip('/preAssessResult/exportSeiCapCalculation',{type,taskId},'抗震能力.zip')
}

// watch(buildVulnerabilityList, (newVal, oldVal) => {
//   getScrollData()
// }, { deep: true, immediate: true, flush: 'post' })


// 生成区县致死性差异性分析
const saveModeldifferenceCreateFinalValue = () => {
  loading.value = true
  let taskDistrict = taskInfo.value.taskDistrict;
  let taskNum = taskInfo.value.taskNum;
  createFinalValue(taskDistrict, taskNum).then(res => {
    if (res.code == 200) {
      proxy.$modal.msgSuccess(res.data);
      loading.value = false
      differenceFlag.value = '1'
    } else {
      loading.value = false
    }
  }).catch(err => {
    loading.value = false
  })
}

// 评估及结果修正
const assessmentData = reactive({
  assessmentList: [],
  assessmentResultsDetailsOpen: false,
  assessmentLoading: false
})
const { assessmentList, assessmentResultsDetailsOpen, assessmentLoading } = toRefs(assessmentData)
// 获取评估结果
const total = ref(0)
const getAssessmentList = (page = 1) => {
  assessmentLoading.value = true
  getAllResult({ taskId, page, rows: 10 }).then(res => {
    if (res.code === 200) {
      if (page == 1) {
        assessmentList.value = []
      } else {
        assessmentList.value = assessmentList.value.splice(0, (page - 1) * 10)
      }
      assessmentList.value.push(...res.data.rows)
      total.value = res.data.total
      // 修正值拆分
      if (assessmentList.value.length != 0) {
        queryDefault(assessmentList.value)
        if (assessmentList.value.length == total.value) {
          isShowAppend.value = false;
          isShowEnd.value = true;
        } else {
          isShowAppend.value = true;
          isShowEnd.value = false;
        }
      } else {
        isShowAppend.value = false;
        isShowEnd.value = false;
      }
      assessmentLoading.value = false;
    }
  }).catch(err => {
    assessmentLoading.value = false
  })
}
const queryDefault = (data) => {
  data.map(item => {
    // 死亡人数
    if (item.deathTollAfter) {
      item.deathTollAfter1 = dataConversion(item.deathTollAfter, 1)
      item.deathTollAfter2 = dataConversion(item.deathTollAfter, 2)
    }
    // 受伤人数
    if (item.injuredNumAfter) {
      item.injuredNumAfter1 = dataConversion(item.injuredNumAfter, 1)
      item.injuredNumAfter2 = dataConversion(item.injuredNumAfter, 2)
    }
    // 灾区经济损失
    if (item.disasterLossAfter) {
      item.disasterLossAfter1 = dataConversion(item.disasterLossAfter, 1)
      item.disasterLossAfter2 = dataConversion(item.disasterLossAfter, 2)
    }
    // 需紧急安置人数
    if (item.resettledNumAfter) {
      item.resettledNumAfter1 = dataConversion(item.resettledNumAfter, 1)
      item.resettledNumAfter2 = dataConversion(item.resettledNumAfter, 2)
    }
    // 需紧急救援力量
    if (item.rescueForceAfter) {
      item.rescueForceAfter1 = dataConversion(item.rescueForceAfter, 1)
      item.rescueForceAfter2 = dataConversion(item.rescueForceAfter, 2)
    }
    // 专业救援力量
    if (item.rescueForceZyAfter) {
      item.rescueForceZyAfter1 = dataConversion(item.rescueForceZyAfter, 1)
      item.rescueForceZyAfter2 = dataConversion(item.rescueForceZyAfter, 2)
    }
    // 民间救援力量
    if (item.rescueForceMjAfter) {
      item.rescueForceMjAfter1 = dataConversion(item.rescueForceMjAfter, 1)
      item.rescueForceMjAfter2 = dataConversion(item.rescueForceMjAfter, 2)
    }
    // 社会其他救援力量
    if (item.rescueForceQtAfter) {
      item.rescueForceQtAfter1 = dataConversion(item.rescueForceQtAfter, 1)
      item.rescueForceQtAfter2 = dataConversion(item.rescueForceQtAfter, 2)
    }
    // 帐篷数
    if (item.tentNumAfter) {
      item.tentNumAfter1 = dataConversion(item.tentNumAfter, 1)
      item.tentNumAfter2 = dataConversion(item.tentNumAfter, 2)
    }
    // 担架
    if (item.stretcherNumAfter) {
      item.stretcherNumAfter1 = dataConversion(item.stretcherNumAfter, 1)
      item.stretcherNumAfter2 = dataConversion(item.stretcherNumAfter, 2)
    }
    // 棉被
    if (item.quiltsNumAfter) {
      item.quiltsNumAfter1 = dataConversion(item.quiltsNumAfter, 1)
      item.quiltsNumAfter2 = dataConversion(item.quiltsNumAfter, 2)
    }
    // 食品
    if (item.foodsNumAfter) {
      item.foodsNumAfter1 = dataConversion(item.foodsNumAfter, 1)
      item.foodsNumAfter2 = dataConversion(item.foodsNumAfter, 2)
    }
    // 饮水
    if (item.waterNumAfter) {
      item.waterNumAfter1 = dataConversion(item.waterNumAfter, 1)
      item.waterNumAfter2 = dataConversion(item.waterNumAfter, 2)
    }
    // 临时厕所
    if (item.bathroomNumAfter) {
      item.bathroomNumAfter1 = dataConversion(item.bathroomNumAfter, 1)
      item.bathroomNumAfter2 = dataConversion(item.bathroomNumAfter, 2)
    }
    // 临时浴室
    if (item.showersNumAfter) {
      item.showersNumAfter1 = dataConversion(item.showersNumAfter, 1)
      item.showersNumAfter2 = dataConversion(item.showersNumAfter, 2)
    }
    // 需医务人员
    if (item.medicalMattersAfter) {
      item.medicalMattersAfter1 = dataConversion(item.medicalMattersAfter, 1)
      item.medicalMattersAfter2 = dataConversion(item.medicalMattersAfter, 2)
    }
    // 医生
    if (item.medicalNumAfter) {
      item.medicalNumAfter1 = dataConversion(item.medicalNumAfter, 1)
      item.medicalNumAfter2 = dataConversion(item.medicalNumAfter, 2)
    }
    // 护士
    if (item.nurseNumAfter) {
      item.nurseNumAfter1 = dataConversion(item.nurseNumAfter, 1)
      item.nurseNumAfter2 = dataConversion(item.nurseNumAfter, 2)
    }
    // 心理医生
    if (item.psychologistAfter) {
      item.psychologistAfter1 = dataConversion(item.psychologistAfter, 1)
      item.psychologistAfter2 = dataConversion(item.psychologistAfter, 2)
    }
    // 病房
    if (item.sickroomNumAfter) {
      item.sickroomNumAfter1 = dataConversion(item.sickroomNumAfter, 1)
      item.sickroomNumAfter2 = dataConversion(item.sickroomNumAfter, 2)
    }
    // 病床
    if (item.sickbedNumAfter) {
      item.sickbedNumAfter1 = dataConversion(item.sickbedNumAfter, 1)
      item.sickbedNumAfter2 = dataConversion(item.sickbedNumAfter, 2)
    }
    // 血浆
    if (item.plasmaNumAfter) {
      item.plasmaNumAfter1 = dataConversion(item.plasmaNumAfter, 1)
      item.plasmaNumAfter2 = dataConversion(item.plasmaNumAfter, 2)
    }
  })
}
const isShowAppend = ref(true)
const isShowEnd = ref(false);
const loadMore = () => {
  if (assessmentList.value.length >= total.value && assessmentList.value.length != 0) {
    isShowAppend.value = false;
    isShowEnd.value = true;
    return
  }
  let page = Math.floor(assessmentList.value.length / 10) + 1
  getAssessmentList(page)
}
// 字符串拆分数组方法
const dataConversion = (str, num) => {
  let arr = str.split('-')
  let splitStr
  if (num === 1) {
    arr[1] ? splitStr = arr[0] : splitStr = '0'
  }
  if (num === 2) {
    arr[1] ? splitStr = arr[1] : splitStr = arr[0]
  }
  return Number(splitStr)
}
// 提交转字符串方法
const arrToStr = (str1, str2) => {
  return [str1, str2].join('-')
}
// 保存评估结果
const saveAssessmentResults = async (tableRef) => {
  let allRes = await getAllNoPage({ taskId })
  queryDefault(allRes.data)
  let allAssessmentList = allRes.data.map(item => {
    if (assessmentList.value.some(cur => cur.id == item.id)) {
      return assessmentList.value.find(cur => cur.id == item.id)
    } else {
      return item
    }
  })
  assessmentList.value = allAssessmentList
  let result = true
  for (let i = 0; i < assessmentList.value.length; i++) {
    // 死亡人数修正校验
    if (!assessmentList.value[i].deathTollAfter1 && assessmentList.value[i].deathTollAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项死亡人数修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].deathTollAfter2 && assessmentList.value[i].deathTollAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项死亡人数修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].deathTollAfter1) !== 0) {
      if (assessmentList.value[i].deathTollAfter2 / assessmentList.value[i].deathTollAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项死亡人数范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 受伤人数修正校验
    if (!assessmentList.value[i].injuredNumAfter1 && assessmentList.value[i].injuredNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项受伤人数修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].injuredNumAfter2 && assessmentList.value[i].injuredNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项受伤人数修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].injuredNumAfter1) !== 0) {
      if (assessmentList.value[i].injuredNumAfter2 / assessmentList.value[i].injuredNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项受伤人数范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 灾区经济损失修正校验
    if (!assessmentList.value[i].disasterLossAfter1 && assessmentList.value[i].disasterLossAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项灾区经济损失修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].disasterLossAfter2 && assessmentList.value[i].disasterLossAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项灾区经济损失修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].disasterLossAfter1) !== 0) {
      if (assessmentList.value[i].disasterLossAfter2 / assessmentList.value[i].disasterLossAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项灾区经济损失范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 需紧急安置人数修正校验
    if (!assessmentList.value[i].resettledNumAfter1 && assessmentList.value[i].resettledNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需紧急安置人数修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].resettledNumAfter2 && assessmentList.value[i].resettledNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需紧急安置人数修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].resettledNumAfter1) !== 0) {
      if (assessmentList.value[i].resettledNumAfter2 / assessmentList.value[i].resettledNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需紧急安置人数范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 需紧急救援力量
    if (!assessmentList.value[i].rescueForceAfter1 && assessmentList.value[i].rescueForceAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需紧急救援力量修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].rescueForceAfter2 && assessmentList.value[i].rescueForceAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需紧急救援力量修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].rescueForceAfter1) !== 0) {
      if (assessmentList.value[i].rescueForceAfter2 / assessmentList.value[i].rescueForceAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需紧急救援力量范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 其中专业救援力量
    if (!assessmentList.value[i].rescueForceZyAfter1 && assessmentList.value[i].rescueForceZyAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项其中专业救援力量修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].rescueForceZyAfter2 && assessmentList.value[i].rescueForceZyAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项其中专业救援力量修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].rescueForceZyAfter1) !== 0) {
      if (assessmentList.value[i].rescueForceZyAfter2 / assessmentList.value[i].rescueForceZyAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项其中专业救援力量范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 其中民间救援力量
    if (!assessmentList.value[i].rescueForceMjAfter1 && assessmentList.value[i].rescueForceMjAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项其中民间救援力量修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].rescueForceMjAfter2 && assessmentList.value[i].rescueForceMjAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项其中民间救援力量修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].rescueForceMjAfter1) !== 0) {
      if (assessmentList.value[i].rescueForceMjAfter2 / assessmentList.value[i].rescueForceMjAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项其中民间救援力量范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 其中社会其他救援力量
    if (!assessmentList.value[i].rescueForceQtAfter1 && assessmentList.value[i].rescueForceQtAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项其中社会其他救援力量修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].rescueForceQtAfter2 && assessmentList.value[i].rescueForceQtAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项其中社会其他救援力量修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].rescueForceQtAfter1) !== 0) {
      if (assessmentList.value[i].rescueForceQtAfter2 / assessmentList.value[i].rescueForceQtAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项其中社会其他救援力量范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 帐篷
    if (!assessmentList.value[i].tentNumAfter1 && assessmentList.value[i].tentNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需帐篷数修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].tentNumAfter2 && assessmentList.value[i].tentNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需帐篷数修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].tentNumAfter1) !== 0) {
      if (assessmentList.value[i].tentNumAfter2 / assessmentList.value[i].tentNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需帐篷数范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 担架
    if (!assessmentList.value[i].stretcherNumAfter1 && assessmentList.value[i].stretcherNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需担架(付)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].stretcherNumAfter2 && assessmentList.value[i].stretcherNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需担架(付)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].stretcherNumAfter1) !== 0) {
      if (assessmentList.value[i].stretcherNumAfter2 / assessmentList.value[i].stretcherNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需担架(付)范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 棉被
    if (!assessmentList.value[i].quiltsNumAfter1 && assessmentList.value[i].quiltsNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需棉被(床)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].quiltsNumAfter2 && assessmentList.value[i].quiltsNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需棉被(床)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].quiltsNumAfter1) !== 0) {
      if (assessmentList.value[i].quiltsNumAfter2 / assessmentList.value[i].quiltsNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需棉被(床)范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 食品
    if (!assessmentList.value[i].foodsNumAfter1 && assessmentList.value[i].foodsNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需食品(吨)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].foodsNumAfter2 && assessmentList.value[i].foodsNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需食品(吨)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].foodsNumAfter1) !== 0) {
      if (assessmentList.value[i].foodsNumAfter2 / assessmentList.value[i].foodsNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需食品(吨)范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 饮水
    if (!assessmentList.value[i].waterNumAfter1 && assessmentList.value[i].waterNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需饮水(吨)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].waterNumAfter2 && assessmentList.value[i].waterNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需饮水(吨)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].waterNumAfter1) !== 0) {
      if (assessmentList.value[i].waterNumAfter2 / assessmentList.value[i].waterNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需饮水(吨)范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 临时厕所
    if (!assessmentList.value[i].bathroomNumAfter1 && assessmentList.value[i].bathroomNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需临时厕所(个)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].bathroomNumAfter2 && assessmentList.value[i].bathroomNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需临时厕所(个)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].bathroomNumAfter1) !== 0) {
      if (assessmentList.value[i].bathroomNumAfter2 / assessmentList.value[i].bathroomNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需临时厕所(个)范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 临时浴室
    if (!assessmentList.value[i].showersNumAfter1 && assessmentList.value[i].showersNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需临时浴室(个)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].showersNumAfter2 && assessmentList.value[i].showersNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需临时浴室(个)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].showersNumAfter1) !== 0) {
      if (assessmentList.value[i].showersNumAfter2 / assessmentList.value[i].showersNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需临时浴室(个)范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 需医务人员
    if (!assessmentList.value[i].medicalMattersAfter1 && assessmentList.value[i].medicalMattersAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需医务人员(人)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].medicalMattersAfter2 && assessmentList.value[i].medicalMattersAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需医务人员(人)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].medicalMattersAfter1) !== 0) {
      if (assessmentList.value[i].medicalMattersAfter2 / assessmentList.value[i].medicalMattersAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需医务人员(人)范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 其中医生
    if (!assessmentList.value[i].medicalNumAfter1 && assessmentList.value[i].medicalNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项其中医生(人)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].medicalNumAfter2 && assessmentList.value[i].medicalNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项其中医生(人)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].medicalNumAfter1) !== 0) {
      if (assessmentList.value[i].medicalNumAfter2 / assessmentList.value[i].medicalNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项其中医生(人)范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 其中护士
    if (!assessmentList.value[i].nurseNumAfter1 && assessmentList.value[i].nurseNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项其中护士(人)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].nurseNumAfter2 && assessmentList.value[i].nurseNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项其中护士(人)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].nurseNumAfter1) !== 0) {
      if (assessmentList.value[i].nurseNumAfter2 / assessmentList.value[i].nurseNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项其中护士(人)范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 其中心理医生
    if (!assessmentList.value[i].psychologistAfter1 && assessmentList.value[i].psychologistAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项其中心理医生(人)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].psychologistAfter2 && assessmentList.value[i].psychologistAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项其中心理医生(人)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].psychologistAfter1) !== 0) {
      if (assessmentList.value[i].psychologistAfter2 / assessmentList.value[i].psychologistAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项其中心理医生(人)范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 病房
    if (!assessmentList.value[i].sickroomNumAfter1 && assessmentList.value[i].sickroomNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需病房(平方米)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].sickroomNumAfter2 && assessmentList.value[i].sickroomNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需病房(平方米)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].sickroomNumAfter1) !== 0) {
      if (assessmentList.value[i].sickroomNumAfter2 / assessmentList.value[i].sickroomNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需病房(平方米)范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 病床
    if (!assessmentList.value[i].sickbedNumAfter1 && assessmentList.value[i].sickbedNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需病床(张)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].sickbedNumAfter2 && assessmentList.value[i].sickbedNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需病床(张))修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].sickbedNumAfter1) !== 0) {
      if (assessmentList.value[i].sickbedNumAfter2 / assessmentList.value[i].sickbedNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需病床(张))范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
    // 血浆
    if (!assessmentList.value[i].plasmaNumAfter1 && assessmentList.value[i].plasmaNumAfter1 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需血浆(升)修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (!assessmentList.value[i].plasmaNumAfter2 && assessmentList.value[i].plasmaNumAfter2 !== 0) {
      ElMessage({
        message: `请设置第${i + 1}项需血浆(升))修正后的值`,
        type: 'warning',
      })
      result = false
      break
    }
    if (Number(assessmentList.value[i].plasmaNumAfter1) !== 0) {
      if (assessmentList.value[i].plasmaNumAfter2 / assessmentList.value[i].plasmaNumAfter1 > 3) {
        ElMessage({
          message: `第${i + 1}项需血浆(升))范围超过3倍`,
          type: 'warning',
        })
        result = false
        break
      }
    }
  }
  if (!result) {
    return
  } else {
    assessmentList.value.map(item => {
      item.deathTollAfter = arrToStr(item.deathTollAfter1, item.deathTollAfter2)
      item.injuredNumAfter = arrToStr(item.injuredNumAfter1, item.injuredNumAfter2)
      item.disasterLossAfter = arrToStr(item.disasterLossAfter1, item.disasterLossAfter2)
      item.resettledNumAfter = arrToStr(item.resettledNumAfter1, item.resettledNumAfter2)
      item.rescueForceAfter = arrToStr(item.rescueForceAfter1, item.rescueForceAfter2)
      item.rescueForceZyAfter = arrToStr(item.rescueForceZyAfter1, item.rescueForceZyAfter2)
      item.rescueForceMjAfter = arrToStr(item.rescueForceMjAfter1, item.rescueForceMjAfter2)
      item.rescueForceQtAfter = arrToStr(item.rescueForceQtAfter1, item.rescueForceQtAfter2)
      item.tentNumAfter = arrToStr(item.tentNumAfter1, item.tentNumAfter2)
      item.stretcherNumAfter = arrToStr(item.stretcherNumAfter1, item.stretcherNumAfter2)
      item.quiltsNumAfter = arrToStr(item.quiltsNumAfter1, item.quiltsNumAfter2)
      item.foodsNumAfter = arrToStr(item.foodsNumAfter1, item.foodsNumAfter2)
      item.waterNumAfter = arrToStr(item.waterNumAfter1, item.waterNumAfter2)
      item.bathroomNumAfter = arrToStr(item.bathroomNumAfter1, item.bathroomNumAfter2)
      item.showersNumAfter = arrToStr(item.showersNumAfter1, item.showersNumAfter2)
      item.medicalMattersAfter = arrToStr(item.medicalMattersAfter1, item.medicalMattersAfter2)
      item.medicalNumAfter = arrToStr(item.medicalNumAfter1, item.medicalNumAfter2)
      item.nurseNumAfter = arrToStr(item.nurseNumAfter1, item.nurseNumAfter2)
      item.psychologistAfter = arrToStr(item.psychologistAfter1, item.psychologistAfter2)
      item.sickroomNumAfter = arrToStr(item.sickroomNumAfter1, item.sickroomNumAfter2)
      item.sickbedNumAfter = arrToStr(item.sickbedNumAfter1, item.sickbedNumAfter2)
      item.plasmaNumAfter = arrToStr(item.plasmaNumAfter1, item.plasmaNumAfter2)
    })
    updateResult(assessmentList.value).then(res => {
      if (res.code === 200) {
        proxy.$modal.msgSuccess("保存成功！");
        // 更新评估结果
        // assessmentList.value = []
        total.value = 0
        getAssessmentList()
        tableRef.setScrollTop(0)
      }
    })
  }
}
// 查看详细评估结果
const getAssessmentResults = () => {
  assessmentData.assessmentResultsDetailsOpen = true
}

function getNowFormatDate() {
  var date = new Date() 
  var year = date.getFullYear()
  var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
  var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() 
  var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours() 
  var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() 
  var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
  return `${year}${month}${day}${hours}${minutes}${seconds}`
}

// 导出评估结果
const handleExportResults = () =>{
  proxy.download(`/result/dataExport/${taskId}`, {
  }, `${metaTitle}${getNowFormatDate()}.xlsx`)
}

// 人员伤亡模型计算
const tab = ref('0')
const casualtiesCalc = (percent) => {
  //loading.value = true
  if (typeof cancelFunc.c === "function") {
    cancelFunc.c('取消成功')
  }
  percentages.value = percent || 0;
  openCreate.value = true;

  let startTime = setInterval(() => {
    if (percentages.value < 50) {
      percentages.value += 5;
    }
    if (percentages.value == 50) {
      clearInterval(startTime);
      let conductTime = setInterval(() => {
        if (percentages.value == 95) {
          clearInterval(conductTime);
        }
        if (percentages.value < 96) {
          percentages.value += 2;
        }
      }, 200)
    }
  }, 200)
  countIntensityAndStructureOfArea({ taskId, tab: tab.value, range: calculateRange.value }).then(res => {
    if (res.code == 200) {
      percentages.value = 100;
      openCreate.value = false;
      casualtiesCalcFlag.value = '1';
      proxy.$modal.msgSuccess(res.data);
      // 更新评估结果
      getAssessmentList()
    } else if (res.code == 501) {
      // tab.value = res.data.tab
      if(calculateRange.value == '0'){
        // 走弹框
        casualtiesCalc501(res)
      } else { 
        // 不走弹框
        casualtiesCalc(percentages.value)
      }
    }
  }).catch(err => {
    //loading.value = false
    openCreate.value = false
    if (err.message !== '取消成功') {
      cancelFunc.c = null
    }
  })
}
const casualtiesCalc501 = (res) => {
  tab.value = res.data.tab
  ElMessageBox.confirm(
    res.message, '消息提示',
    {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning',
      cancelButtonClass: 'is-plain',
    }
  ).then(() => {
    casualtiesCalc()
  })
    .catch(() => {
      tab.value = '0';
      openCreate.value = false;
      percentages.value = 0;
    })
}

const casualtiesCalc2 = () => {
  if (casualtiesCalcFlag.value == '0') {
    proxy.$modal.msgWarning('请先计算各烈度下建筑物破坏！！')
    return
  }
  //loading.value = true
  if (typeof cancelFunc.c === "function") {
    cancelFunc.c('取消成功')
  }
  percentages.value = 0;
  openCreate.value = true;

  let startTime = setInterval(() => {
    if (percentages.value < 50) {
      percentages.value += 5;
    }
    if (percentages.value == 50) {
      clearInterval(startTime);
      let conductTime = setInterval(() => {
        if (percentages.value == 95) {
          clearInterval(conductTime);
        }
        if (percentages.value < 96) {
          percentages.value += 2;
        }
      }, 100)
    }
  }, 100)
  savePbeInjuries({ modeId: casualtiesData.value.id, taskId }).then(res => {
    if (res.code == 200) {
      percentages.value = 100;
      openCreate.value = false;
      proxy.$modal.msgSuccess(res.data);
      casualtiesCalcFlag2.value = '1';
      // 更新评估结果
      getAssessmentList()
    }
  }).catch(err => {
    //loading.value = false
    openCreate.value = false
    if (err.message !== '取消成功') {
      cancelFunc.c = null
    }
  })
}

const casualtiesCalc3 = () => {
  if (casualtiesCalcFlag.value == '0') {
    proxy.$modal.msgWarning('请先计算各烈度下建筑物破坏！！')
    return
  }
  if (casualtiesCalcFlag2.value == '0') {
    proxy.$modal.msgWarning('请先计算各烈度下人员伤亡！！')
    return
  }
  //loading.value = true
  if (typeof cancelFunc.c === "function") {
    cancelFunc.c('取消成功')
  }
  percentages.value = 0;
  openCreate.value = true;

  let startTime = setInterval(() => {
    if (percentages.value < 50) {
      percentages.value += 5;
    }
    if (percentages.value == 50) {
      clearInterval(startTime);
      let conductTime = setInterval(() => {
        if (percentages.value == 95) {
          clearInterval(conductTime);
        }
        if (percentages.value < 96) {
          percentages.value += 2;
        }
      }, 100)
    }
  }, 100)
  casualtiesCalculate({ taskId, range: calculateRange.value }).then(res => {
    if (res.code == 200) {
      percentages.value = 100;
      openCreate.value = false
      proxy.$modal.msgSuccess(res.data);
      casualtiesCalcFlag3.value = '1';
      // 更新评估结果
      getAssessmentList()
    }
  }).catch(err => {
    //loading.value = false
    openCreate.value = false
    if (err.message !== '取消成功') {
      cancelFunc.c = null
    }
  })
}
// 导出各烈度建筑物破坏结果
const exportCasualtiesCalc = (url,name) =>{
  proxy.downloadZip(url,{taskId},name)
}
// 经济损失模型计算
const tab2 = ref('0')
const economicCalc = (percent) => {
  //loading.value = true
  if (typeof cancelFunc.c === "function") {
    cancelFunc.c('取消成功')
  }
  percentages.value = 0;
  openCreate.value = true;

  let startTime = setInterval(() => {
    if (percentages.value < 50) {
      percentages.value += 5;
    }
    if (percentages.value == 50) {
      clearInterval(startTime);
      let conductTime = setInterval(() => {
        if (percentages.value == 95) {
          clearInterval(conductTime);
        }
        if (percentages.value < 96) {
          percentages.value += 2;
        }
      }, 100)
    }
  }, 100)
  savePbeLosses({ modeId: economicData.value.id, taskId, tab: tab2.value, range: calculateRange.value }).then(res => {
    if (res.code == 200) {
      percentages.value = 100;
      openCreate.value = false;
      economicCalcFlag.value = '1';
      proxy.$modal.msgSuccess(res.data)
      getAssessmentList()
    } else if (res.code == 501) {
      if(calculateRange.value == '0') {
        economicCalc501(res)
      } else {
        economicCalc(percentages.value)
      }
    }
  }).catch(err => {
    //loading.value = false
    openCreate.value = false
    if (err.message !== '取消成功') {
      cancelFunc.c = null
    }
  })
}
const economicCalc501 = (res) => {
  tab2.value = res.data.tab
  ElMessageBox.confirm(
    res.message,
    '消息提示',
    {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning',
      cancelButtonClass: 'is-plain',
    }
  ).then(() => {
    economicCalc()
  }).catch(() => {
    tab2.value = '0';
    openCreate.value = false;
    percentages.value = 0;
  })
}

const economicCalc2 = () => {
  if (economicCalcFlag.value == '0') {
    proxy.$modal.msgWarning('请先计算各烈度下经济损失分布！！');
    return
  }
  //loading.value = true
  if (typeof cancelFunc.c === "function") {
    cancelFunc.c('取消成功')
  }
  percentages.value = 0;
  openCreate.value = true;

  let startTime = setInterval(() => {
    if (percentages.value < 50) {
      percentages.value += 5;
    }
    if (percentages.value == 50) {
      clearInterval(startTime);
      let conductTime = setInterval(() => {
        if (percentages.value == 95) {
          clearInterval(conductTime);
        }
        if (percentages.value < 96) {
          percentages.value += 2;
        }
      }, 100)
    }
  }, 100)
  economicCalculate({ taskId, range: calculateRange.value }).then(res => {
    if (res.code == 200) {
      percentages.value = 100;
      openCreate.value = false;
      proxy.$modal.msgSuccess(res.data);
      economicCalcFlag2.value = '1';
      getAssessmentList()
    } else {
      //loading.value = false
      proxy.$modal.msgError(res.message);
    }
  }).catch(err => {
    //loading.value = false
    openCreate.value = false
    if (err.message !== '取消成功') {
      cancelFunc.c = null
    }
  })
}

// 需安置人员模型计算
const tab1 = ref('0')
const resettlementCalc = (percent) => {
  if (typeof cancelFunc.c === "function") {
    cancelFunc.c('取消成功')
  }
  percentages.value = 0;
  openCreate.value = true;

  let startTime = setInterval(() => {
    if (percentages.value < 50) {
      percentages.value += 5;
    }
    if (percentages.value == 50) {
      clearInterval(startTime);
      let conductTime = setInterval(() => {
        if (percentages.value == 95) {
          clearInterval(conductTime);
        }
        if (percentages.value < 96) {
          percentages.value += 2;
        }
      }, 100)
    }
  }, 100)
  if (radio.resettlementRadio == '1') {
    //loading.value = true
    AzMath({ taskId: taskId, tab: tab1.value, range: calculateRange.value }).then(res => {
      percentages.value = 100;
      openCreate.value = false
      if (res.code == 200) {
        //loading.value = false
        clearInterval(startTime)
        proxy.$modal.msgSuccess(res.data);
        resettlementFalg.value = '1'
        // 更新评估结果
        getAssessmentList()
      } else if (res.code == 501) {
        //loading.value = false
        if(calculateRange.value == '0') {
          resettlementCalcAzMath501(res)
        } else {
          resettlementCalc(percentages.value)
        }
      }
    }).catch(err => {
      //loading.value = false
      openCreate.value = false
      if (err.message !== '取消成功') {
        cancelFunc.c = null
      }
    })
  } else if (radio.resettlementRadio == '2') {
    //loading.value = true
    AzCount({ modelId: resettlementData.value.id, taskId }).then(res => {
      percentages.value = 100;
      openCreate.value = false
      if (res.code == 200) {
        //loading.value = false
        clearInterval(startTime)
        proxy.$modal.msgSuccess(res.data);
        resettlementFalg.value = '1'
        // 更新评估结果
        getAssessmentList()
      } else {
        //loading.value = false
      }
    }).catch(err => {
      //loading.value = false
      openCreate.value = false
      if (err.message !== '取消成功') {
        cancelFunc.c = null
      }
    })
  }
}
const resettlementCalcAzMath501 = (res) => {
  tab1.value = res.data.tab
  ElMessageBox.confirm(
    res.message,
    '消息提示',
    {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning',
      cancelButtonClass: 'is-plain',
    }
  )
    .then(() => {
      resettlementCalc()
    })
    .catch(() => {
      tab1.value = '0';
      percentages.value = 0;
      openCreate.value = false
    })
}
const resettlementCalc2 = () => {
  if (resettlementFalg.value == '0') {
    proxy.$modal.msgWarning('请先计算各烈度下需紧急安置人数分布！！')
    return
  }
  if (typeof cancelFunc.c === "function") {
    cancelFunc.c('取消成功')
  }
  percentages.value = 0;
  openCreate.value = true;

  let startTime = setInterval(() => {
    if (percentages.value < 50) {
      percentages.value += 5;
    }
    if (percentages.value == 50) {
      clearInterval(startTime);
      let conductTime = setInterval(() => {
        if (percentages.value == 95) {
          clearInterval(conductTime);
        }
        if (percentages.value < 96) {
          percentages.value += 2;
        }
      }, 100)
    }
  }, 100)
  //loading.value = true
  newCalculate({ taskId, range: calculateRange.value }).then(res => {
    percentages.value = 100;
    openCreate.value = false
    if (res.code == 200) {
      //loading.value = false
      clearInterval(startTime)
      proxy.$modal.msgSuccess(res.data);
      resettlementFalg2.value = '1'
      // 更新评估结果
      getAssessmentList()
    } else {
      //loading.value = false
    }
  }).catch(err => {
    //loading.value = false
    openCreate.value = false
    if (err.message !== '取消成功') {
      cancelFunc.c = null
    }
  })
}
// 救援力量需求模型计算
const rescueforceCalc = () => {
  //loading.value = true
  if (typeof cancelFunc.c === "function") {
    cancelFunc.c('取消成功')
  }
  percentages.value = 0;
  openCreate.value = true;

  let startTime = setInterval(() => {
    if (percentages.value < 50) {
      percentages.value += 5;
    }
    if (percentages.value == 50) {
      clearInterval(startTime);
      let conductTime = setInterval(() => {
        if (percentages.value == 95) {
          clearInterval(conductTime);
        }
        if (percentages.value < 96) {
          percentages.value += 2;
        }
      }, 100)
    }
  }, 100)
  countRescueForce({ modelId: rescueforceData.value.id, taskId }).then(res => {
    percentages.value = 100;
    openCreate.value = false
    if (res.code == 200) {
      //loading.value = false
      clearInterval(startTime)
      proxy.$modal.msgSuccess(res.data);
      rescueforceFlag.value = '1'
      // 更新评估结果
      getAssessmentList()
    } else {
      //loading.value = false
    }
  }).catch(err => {
    //loading.value = false
    openCreate.value = false
    if (err.message !== '取消成功') {
      cancelFunc.c = null
    }
  })
}
// 救援物资需求模型计算
const materialCalc = () => {
  //loading.value = true
  if (typeof cancelFunc.c === "function") {
    cancelFunc.c('取消成功')
  }
  percentages.value = 0;
  openCreate.value = true;

  let startTime = setInterval(() => {
    if (percentages.value < 50) {
      percentages.value += 5;
    }
    if (percentages.value == 50) {
      clearInterval(startTime);
      let conductTime = setInterval(() => {
        if (percentages.value == 95) {
          clearInterval(conductTime);
        }
        if (percentages.value < 96) {
          percentages.value += 2;
        }
      }, 100)
    }
  }, 100)
  countMaterial({ modelId: materialData.value.id, taskId }).then(res => {
    percentages.value = 100;
    openCreate.value = false
    if (res.code == 200) {
      //loading.value = false
      clearInterval(startTime)
      proxy.$modal.msgSuccess(res.data);
      materialFlag.value = '1'
      // 更新评估结果
      getAssessmentList()
    } else {
      //loading.value = false
    }
  }).catch(err => {
    //loading.value = false
    openCreate.value = false
    if (err.message !== '取消成功') {
      cancelFunc.c = null
    }
  })
}
// 选择地震滑坡模型计算
const intensityForm = reactive({
  dzIntensity: '',
  parameter: '',
  // slopeVersion:'',
})
const intensityRef = ref()
let cancelFunc = {}
const tab3 = ref('0')
const landslideCalc = () => {

  intensityRef.value.validate(valid => {
    if (valid) {
      //loading.value = true
      if (typeof cancelFunc.c === "function") {
        cancelFunc.c('取消成功')
      }
      percentages.value = 0;
      openCreate.value = true;

      let startTime = setInterval(() => {
        if (percentages.value < 50) {
          percentages.value += 5;
        }
        if (percentages.value == 50) {
          clearInterval(startTime);
          let conductTime = setInterval(() => {
            if (percentages.value == 95) {
              clearInterval(conductTime);
            }
            if (percentages.value < 96) {
              percentages.value += 2;
            }
          }, 100)
        }
      }, 100)
      if (radio.landslideRadio == "1") {
        countLandslide({
          taskId,
          type: radio.landslideRadio,
          dzIntensity: intensityForm.dzIntensity,
          parameter: intensityForm.parameter,
          tab: tab3.value
          // slopeVersion:intensityForm.slopeVersion,
        })
          .then(res => {
            percentages.value = 100;
            openCreate.value = false
            if (res.code == 200) {
              //loading.value = false
              clearInterval(startTime)
              proxy.$modal.alertSuccess("逻辑斯蒂滑坡模型计算成功！");
              EQLandslideFlag.value = '1'
              // 更新评估结果
              getAssessmentList()
            } else if (res.code == 501) {
              ElMessageBox.confirm(
                res.message,
                '消息提示',
                {
                  confirmButtonText: '确定',
                  cancelButtonText: '取消',
                  type: 'warning',
                  cancelButtonClass: 'is-plain',
                }
              )
                .then(() => {
                  //loading.value = true
                  tab3.value = res.data.tab
                  if (typeof cancelFunc.c === "function") {
                    cancelFunc.c('取消成功')
                  }
                  percentages.value = 0;
                  openCreate.value = true;

                  let startTime = setInterval(() => {
                    if (percentages.value < 50) {
                      percentages.value += 5;
                    }
                    if (percentages.value == 50) {
                      clearInterval(startTime);
                      let conductTime = setInterval(() => {
                        if (percentages.value == 95) {
                          clearInterval(conductTime);
                        }
                        if (percentages.value < 96) {
                          percentages.value += 2;
                        }
                      }, 200)
                    }
                  }, 200)
                  countLandslide({
                    taskId,
                    type: radio.landslideRadio,
                    dzIntensity: intensityForm.dzIntensity,
                    parameter: intensityForm.parameter,
                    tab: res.data.tab
                  }).then(response => {
                    if (response.code == 200) {
                      percentages.value = 100;
                      openCreate.value = false;
                      clearInterval(startTime)
                      EQLandslideFlag.value = '1'
                      proxy.$modal.alertSuccess("逻辑斯蒂滑坡模型计算成功！");
                      // 更新评估结果
                      getAssessmentList()
                    }
                  }).catch(err => {
                    //loading.value = false
                    openCreate.value = false
                    if (err.message !== '取消成功') {
                      cancelFunc.c = null
                    }
                  })
                })
                .catch(() => {
                  tab3.value = '0';
                  openCreate.value = false;
                  percentages.value = 0;
                })
            }
          }).catch(err => {
            //loading.value = false
            openCreate.value = false
            if (err.message !== '取消成功') {
              cancelFunc.c = null
            }
          })
      } else if (radio.landslideRadio == "2") {
        count2({
          taskId: taskId,
          dzIntensity: intensityForm.dzIntensity,
          parameter: intensityForm.parameter,
          lithologyVersion: intensityForm.lithologyVersion, //地层岩性
          phyVersion: intensityForm.landformsVersion, //地貌
          natDenVersion: intensityForm.densityVersion, //天然密度
          slopeVersion: intensityForm.slopeVersion //坡度

        })
          .then(res => {
            if (res.code == 200) {
              percentages.value = 100;
              proxy.$modal.alertSuccess("黄土高原滑坡模型计算成功！");
              EQLandslideFlag.value = '1'
              // 更新评估结果
              getAssessmentList()
            } else if(res.code == 503) {
              ElMessageBox.alert(res.data, '消息提示', {
                confirmButtonText: '关闭',
              })
            }
            loading.value = false
            openCreate.value = false
          }).catch(err => {
            loading.value = false
            openCreate.value = false
          })
      }
    }
  })
}


// taskType = 0 代表已分配
// 内容前两项
const isAssign = computed(() => {
  // 待分配（不包含无子任务2-不需要分配）
  let flag1 = taskType != '0' && curTaskType != '2'
  // 已分配的父任务
  let flag2 = taskType == '0' && curTaskType == '1'
  return flag1 || flag2
})

// 设定地震按钮及批量删除按钮-子任务且有设定地震数据 待分配 子任务3
const isBtn = computed(() => {
  // return (taskType == '1' && curTaskType != '3') || curTaskType == '2'
  return true
})
// 设定地震模块-有子任务1&&分配后&&无数据
const isSetEQ = computed(() => {
  let flag2 = curTaskType == '1' && taskType == 0 && setEarthquakeList.value.length == 0
  return flag2
})

watch([() => isSetEQ.value, () => isAssign.value], () => {
  nextTick(() => {
    getScrollData()
  })
}, { deep: true, immediate: true })

/*地图使用start*/
const router = useRouter();
//点状设定地震
function pointSetEarthquake() {
  let id = taskId;
  let type = taskType;
  router.push({
    path: '/earthquakeSetting/PointSet',
    query: {
      id: id,
      taskType: type,
      pattern: curTaskType,
      type: "1",
      name: metaTitle,
      metaTitle: "点状设定地震"
    }
  })
}

//断层设定地震
function faultSetEarthquake() {
  let id = taskId;
  let type = taskType;
  router.push({
    path: '/earthquakeSetting/PointSet',
    query: {
      id: id,
      taskType: type,
      pattern: curTaskType,
      type: "2",
      name: metaTitle,
      metaTitle: "断层设定地震"
    }
  })
}

//公里格网设定地震
function gridSetEarthquake() {
  let id = taskId;
  let type = taskType;
  router.push({
    path: '/earthquakeSetting/PointSet',
    query: {
      id: id,
      taskType: type,
      pattern: curTaskType,
      type: "3",
      name: metaTitle,
      metaTitle: "公里格网设定地震"
    }
  })
}

//查看地震影响场
function influencefliedEarthquake(title) {
  let id = taskId;
  let type = taskType;
  router.push({
    path: '/earthquakeSetting/Influenceflied',
    query: {
      id: id,
      taskType: type,
      pattern: curTaskType,
      name: metaTitle,
      metaTitle: title
    }
  })
}

const minList = ref([]);//要上传的文件的后缀名数组
const nameList = ref([]);//要上传的文件的文件名数组
const uploadInfoVisible = ref(false);//是否显示上传消息弹窗
const uploadMsg = ref("");//上传结果返回值
const upload = (index) => {
  document.getElementById("influenceflied-button-selectfile" + index).click()
}
//选择文件
function uploadFileChange(index, row) {
  let uploadinputFiles = document.getElementById("influenceflied-button-selectfile" + index).files;
  minList.value = [];
  nameList.value = [];
  for (let i = 0; i < uploadinputFiles.length; i++) {
    // 获取这个文件的后缀名
    minList.value.push(uploadinputFiles[i].name.slice(uploadinputFiles[i].name.length - 3, uploadinputFiles[i].name.length));
    nameList.value.push(uploadinputFiles[i].name.split(".")[0]);
  }
  if (!judgeIsOnce(minList.value)) {
    proxy.$modal.msgError('上传数量限制:.dbf、.prj、.shp、.shx、.cpg文件各1个;.sbn、.sbx、.shp.xml文件至多一个。');
    return;
  } else if (!judgeName(nameList.value)) {
    proxy.$modal.msgError('文件名请保持一致！');
    return;
  }
  uploadFileClick(index, row)
}

//上传文件
function uploadFileClick(index, row) {
  let uploadinput = document.getElementById("influenceflied-button-selectfile" + index);
  if (uploadinput.value == "") {
    proxy.$modal.msgError('上传前请先选择文件！');
    return;
  }
  let formData = new FormData();
  for (let i = 0; i < uploadinput.files.length; i++) {
    formData.append('files', uploadinput.files[i]);
  }
  formData.append("taskId", taskId);
  formData.append("detailsId", row.id);
  loading.value = true;
  //上传
  influencefliedUpload(formData).then((response) => {
    nextTick(() => {
      let msg = response.data;
      loading.value = false;
      uploadMsg.value = msg;//上传消息返回值
      if (msg.indexOf("上传成功.") != -1) {
        intensityType.value = '1';
        if (msg.indexOf("当前数据所在文件UUID") != -1) {
          uploadMsg.value = msg.split("当前数据所在文件UUID")[0];
        }
        settingSeismicDetails.value[index].importFlag = '1'
        // 建筑易损性矩阵列表刷新
        // getMatrixList()
        // 更新评估结果
        getAssessmentList()
      }
      uploadInfoVisible.value = true;//是否显示上传消息弹窗
    });
  }).catch(err => {
    loading.value = false;
  })
}

//校验shp文件类型
function judgeIsOnce(list) {
  // ["dbf","prj","shp","shx","cpg"];
  let dbf = 0, prj = 0, shp = 0, shx = 0, cpg = 0, sbn = 0, sbx = 0, xml = 0;
  for (let i = 0; i < list.length; i++) {
    let item = list[i];
    if (item == 'dbf') dbf++;
    if (item == 'prj') prj++;
    if (item == 'shp') shp++;
    if (item == 'shx') shx++;
    if (item == 'cpg') cpg++;
    if (item == 'sbn') sbn++;
    if (item == 'sbx') sbx++;
    if (item == 'xml') xml++;
  }
  if (dbf == 1 && prj == 1 && shp == 1 && shx == 1 && cpg == 1 && sbn < 2 && sbx < 2 && xml < 2) return true;
  else return false;
}

//校验shp文件名称
function judgeName(list) {
  let name = list[0];
  let result = list.filter(function (item) {
    return item == name;
  })
  if (result.length == list.length) return true;
  else return false;
}

//关闭上传消息弹窗
function uploadHandleClose() {
  uploadInfoVisible.value = false;//是否显示上传消息弹窗
}
/*地图使用end*/

// 更多数据
function handleMore(row) {
  proxy.$refs['tableRef'].toggleRowExpansion(row);
}
// 选择版本
function handleSelect(row) {
  if (row.dataTypeLevel3Code == "dcyx1") {
    isLithologyShowButton.value = false;
    intensityForm.lithologyVersion = row.versionCode;
    intensityRef.value.validateField('lithologyVersion');
    // intensityRef.value.resetFields('lithologyVersion');
  } else if (row.dataTypeLevel3 == "4") {
    isLandformsShowButton.value = false;
    intensityForm.landformsVersion = row.versionCode;
    intensityRef.value.validateField('landformsVersion');
    // intensityRef.value.resetFields('landformsVersion');
  } else if (row.dataTypeLevel3 == "5") {
    isDensityShowButton.value = false;
    intensityForm.densityVersion = row.versionCode;
    intensityRef.value.validateField('densityVersion');
    // intensityRef.value.resetFields('densityVersion');
  } else if (row.dataTypeLevel3 == "dxdmpd") {
    isSlopeShowButton.value = false;
    intensityForm.slopeVersion = row.versionCode;
    intensityRef.value.validateField('slopeVersion');
    // intensityRef.value.resetFields('slopeVersion');
  }
  openSlope.value = false;
  //		selectVersionCode({"versionCode":row.versionCode,"taskId":route.query.taskId,"disasterType":"3"}).then(response => {			
  //			console.log(response.data)	
  //			openSlope.value = false;
  //			proxy.$modal.msgSuccess(response.message);
  //
  //		});

}
//坡度数据选择
const openNum = ref(0);
function selectSlope() {
  openNum.value = 0;
  queryParamsSel.value = {
    page: 1,
    rows: 10,
  };
  openSlope.value = true;
  getSlopeDataList();
}

//地层岩性选择
function selectLithology() {
  openNum.value = 1;
  queryParamsSel.value = {
    page: 1,
    rows: 10,
  };
  openSlope.value = true;
  getLithologyDataList();
}
//地貌数据选择
function selectLandforms() {
  openNum.value = 2;
  queryParamsSel.value = {
    page: 1,
    rows: 10,
  };
  openSlope.value = true;
  getLandformsDataList("4");
}
//天然密度选择
function selectDensity() {
  openNum.value = 3;
  queryParamsSel.value = {
    page: 1,
    rows: 10,
  };
  openSlope.value = true;
  getLandformsDataList("5");
}

//获取坡度数据版本
function getSlopeDataList() {
  loadingSel.value = true;
  var province = route.query.taskDistrict?.split("-")[0];
  getSlopeData({ ...queryParamsSel.value, distinct: province, dataTypeLevel3: 'dxdmpd' }).then(response => {
    loadingSel.value = false;
    slopeDataList.value = response.data.rows ? response.data.rows : [];
    totalSel.value = response.data.total;
  });
}
//获取地层岩性版本
function getLithologyDataList() {
  loadingSel.value = true;
  getVersionListData({ ...queryParamsSel.value, "dataType2": "94", "typeCode": "dcyx1" }).then(response => {
    loadingSel.value = false;
    slopeDataList.value = response.data.list ? response.data.list : [];
    totalSel.value = response.data.total;
  });
}
//获取地貌天然密度数据版本
function getLandformsDataList(type) {
  loadingSel.value = true;
  getBusinessVersionListData({ ...queryParamsSel.value, "dataTypeLevel3": type }).then(response => {
    loadingSel.value = false;
    slopeDataList.value = response.data.rows ? response.data.rows : [];
    totalSel.value = response.data.total;
  });
}
/** 搜索按钮操作 */
function handleQuerySel() {
  if (openNum.value == 0) {
    getSlopeDataList();
  } else if (openNum.value == 1) {
    getLithologyDataList();
  } else if (openNum.value == 2) {
    getLandformsDataList("4");
  } else if (openNum.value == 3) {
    getLandformsDataList("5");
  }
}

/** 重置按钮操作 */
function resetQuerySel() {
  proxy.resetForm("querySelRef");
  queryParamsSel.value = {
    page: 1,
    rows: 10,
  };
  handleQuerySel();
}
// 取消按钮
function cancel() {
  openSlope.value = false;
  //reset();
}
</script>
<style scoped lang="scss">
@import '@/assets/styles/variables.module.scss';
$baseColor: var(--el-color-primary);

:deep(.el-form-item__error) {
  width: 200px;
}

.app-container {
  width: 100%;
  min-width: 1200px;

  .detail-container {
    position: relative;

    .el-row {
      // align-items: baseline;
      margin: 5px 0;
    }

    .detail-form {
      &-item>div {
        width: calc(100% / 3);
        display: inline-block
      }

      .el-form-item--default,
      .el-form-item {
        margin: 2px 0;
      }

      .el-divider--horizontal {
        margin: 0;
      }
    }

    .detail {
      .secondary-title {
        font-weight: bold;
        font-size: 16px
      }

      .calc-btn {
        .el-button {
          width: 100% !important;
          :deep(span){
            display: inline-block !important;
            width: 100% !important;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        }
      }

      ul {
        padding-left: 24px;
      }

      .viewAssessment {
        margin: 10px 0;
      }

      .el-link {
        margin-right: 10px;
      }
    }

    .detail-left {
      padding-left: 24px;
    }

    .setEarthquake {
      &-tips {
        border: 1px solid $--color-warning;
        color: $--color-warning;
        border-radius: 3px;
        padding: 5px;
        list-style: disc;
      }

      &-button {
        margin: 15px 0;
      }

      &-detail-1 {
        .el-row {
          margin: 10px 0;
        }
      }

      &-detail-2 {
        margin: 10px;
      }

      &-table {
        margin: 10px 0;
      }

      &-detail-3 {
        .explain {
          color: $baseColor;
        }
      }
    }

    .success-btn-icon {
      .el-icon {
        color: $--color-success;
      }
    }

    .success-btn-icon.el-button--primary.is-plain {
      background-color: #ecf5ff !important;
      color: var(--el-color-primary) !important;
    }
  }

  :deep(.el-table) th.el-table__cell {
    border-bottom: 1px solid #e5ebf7 !important;
    border-right: 1px solid #e5ebf7 !important;
  }
}
</style>